Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(terraform): simplify the account setup remote state #119

Merged
merged 4 commits into from
May 29, 2024

Conversation

JoshuaLicense
Copy link
Contributor

Description

This PR simplifies the remote-state handling on initial account setup.

It:

  • Moves from subdirectories of accounts into an _init directory to reduce duplication.
  • Removes point_in_time_recovery_enabled from the remote-state module. This is not useful for the Dynamodb instance.

Before submitting (or marking as "ready for review")

  • Does the pull request title follow the conventional commit specification?
  • Have you performed a self-review of the code
  • Have you have added tests that prove the fix or feature is effective and working
  • Did you make sure to update any documentation relating to this change?

@JoshuaLicense JoshuaLicense self-assigned this May 29, 2024
Copy link
Contributor

github-actions bot commented May 29, 2024

Terraform plan for account: nonprod

Commit: e00b47e

Plan summary

0 to add, 4 to change, 0 to destroy

🔄 Updates

module.account-remote-state.module.dynamodb_table.aws_dynamodb_table.this[0]
module.environment-remote-state["dev"].module.dynamodb_table.aws_dynamodb_table.this[0]
module.account.module.github[0].module.iam_github_oidc_readonly_role[0].aws_iam_role.this[0]
module.account.module.github[0].module.iam_github_oidc_role[0].aws_iam_role.this[0]

Show full plan
Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  # module.account-remote-state.module.dynamodb_table.aws_dynamodb_table.this[0] will be updated in-place
  ~ resource "aws_dynamodb_table" "this" {
        id                          = "vol-app-054614622558-terraform-state-lock"
        name                        = "vol-app-054614622558-terraform-state-lock"
        tags                        = {
            "Name" = "vol-app-054614622558-terraform-state-lock"
        }
        # (12 unchanged attributes hidden)

      ~ point_in_time_recovery {
          ~ enabled = true -> false
        }

      + timeouts {
          + create = "10m"
          + delete = "10m"
          + update = "60m"
        }

        # (2 unchanged blocks hidden)
    }

  # module.environment-remote-state["dev"].module.dynamodb_table.aws_dynamodb_table.this[0] will be updated in-place
  ~ resource "aws_dynamodb_table" "this" {
        id                          = "vol-app-054614622558-dev-terraform-state-lock"
        name                        = "vol-app-054614622558-dev-terraform-state-lock"
        tags                        = {
            "Name" = "vol-app-054614622558-dev-terraform-state-lock"
        }
        # (12 unchanged attributes hidden)

      ~ point_in_time_recovery {
          ~ enabled = true -> false
        }

        # (3 unchanged blocks hidden)
    }

  # module.account.module.github[0].module.iam_github_oidc_readonly_role[0].aws_iam_role.this[0] will be updated in-place
  ~ resource "aws_iam_role" "this" {
      ~ assume_role_policy    = jsonencode(
          ~ {
              ~ Statement = [
                  ~ {
                      ~ Condition = {
                          ~ "ForAllValues:StringEquals" = {
                              ~ "token.actions.githubusercontent.com:iss" = "http://token.actions.githubusercontent.com" -> "https://token.actions.githubusercontent.com"
                                # (1 unchanged attribute hidden)
                            }
                            # (1 unchanged attribute hidden)
                        }
                        # (4 unchanged attributes hidden)
                    },
                ]
                # (1 unchanged attribute hidden)
            }
        )
        id                    = "vol-app-github-actions-readonly-role"
        name                  = "vol-app-github-actions-readonly-role"
        tags                  = {}
        # (11 unchanged attributes hidden)
    }

  # module.account.module.github[0].module.iam_github_oidc_role[0].aws_iam_role.this[0] will be updated in-place
  ~ resource "aws_iam_role" "this" {
      ~ assume_role_policy    = jsonencode(
          ~ {
              ~ Statement = [
                  ~ {
                      ~ Condition = {
                          ~ "ForAllValues:StringEquals" = {
                              ~ "token.actions.githubusercontent.com:iss" = "http://token.actions.githubusercontent.com" -> "https://token.actions.githubusercontent.com"
                                # (1 unchanged attribute hidden)
                            }
                            # (1 unchanged attribute hidden)
                        }
                        # (4 unchanged attributes hidden)
                    },
                ]
                # (1 unchanged attribute hidden)
            }
        )
        id                    = "vol-app-github-actions-role"
        name                  = "vol-app-github-actions-role"
        tags                  = {}
        # (11 unchanged attributes hidden)
    }

Plan: 0 to add, 4 to change, 0 to destroy.

@JoshuaLicense JoshuaLicense merged commit 9ed6203 into main May 29, 2024
17 checks passed
@JoshuaLicense JoshuaLicense deleted the simplify-remote-state-account-setup branch May 29, 2024 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant