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

fix(terraform): pass legacy_environment to fix secrets/parameter #217

Merged
merged 1 commit into from
Aug 5, 2024

Conversation

JoshuaLicense
Copy link
Contributor

Description

Adds a legacy_environment variable to pass to the container environment. The app code is still working on the legacy env names.

@JoshuaLicense JoshuaLicense self-assigned this Aug 5, 2024
Copy link
Contributor

github-actions bot commented Aug 5, 2024

Terraform plan for environment: int

Commit: f45fba3

API version: 418eb0c
CLI version: 418eb0c
Selfserve version: 418eb0c
Internal version: 418eb0c

Plan summary

3 to add, 3 to change, 0 to destroy

🆕 Creates

module.service.module.ecs_service["api"].aws_ecs_task_definition.this[0]
module.service.module.ecs_service["internal"].aws_ecs_task_definition.this[0]
module.service.module.ecs_service["selfserve"].aws_ecs_task_definition.this[0]

📖 Reads

module.service.module.ecs_service["api"].data.aws_ecs_task_definition.this[0]
module.service.module.ecs_service["internal"].data.aws_ecs_task_definition.this[0]
module.service.module.ecs_service["selfserve"].data.aws_ecs_task_definition.this[0]

🔄 Updates

module.service.module.ecs_service["api"].aws_ecs_service.this[0]
module.service.module.ecs_service["internal"].aws_ecs_service.this[0]
module.service.module.ecs_service["selfserve"].aws_ecs_service.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
+/- create replacement and then destroy
 <= read (data resources)

Terraform will perform the following actions:

  # module.service.module.ecs_service["api"].data.aws_ecs_task_definition.this[0] will be read during apply
  # (depends on a resource or a module with changes pending)
 <= data "aws_ecs_task_definition" "this" {
      + arn                  = (known after apply)
      + arn_without_revision = (known after apply)
      + execution_role_arn   = (known after apply)
      + family               = (known after apply)
      + id                   = (known after apply)
      + network_mode         = (known after apply)
      + revision             = (known after apply)
      + status               = (known after apply)
      + task_definition      = "vol-app-int-api-service"
      + task_role_arn        = (known after apply)
    }

  # module.service.module.ecs_service["api"].aws_ecs_service.this[0] will be updated in-place
  ~ resource "aws_ecs_service" "this" {
        id                                 = "arn:aws:ecs:eu-west-1:054614622558:service/vol-app-int-api-cluster/vol-app-int-api-service"
        name                               = "vol-app-int-api-service"
        tags                               = {}
      ~ task_definition                    = "vol-app-int-api-service:1" -> (known after apply)
        # (16 unchanged attributes hidden)

        # (5 unchanged blocks hidden)
    }

  # module.service.module.ecs_service["api"].aws_ecs_task_definition.this[0] must be replaced
+/- resource "aws_ecs_task_definition" "this" {
      ~ arn                      = "arn:aws:ecs:eu-west-1:054614622558:task-definition/vol-app-int-api-service:1" -> (known after apply)
      ~ arn_without_revision     = "arn:aws:ecs:eu-west-1:054614622558:task-definition/vol-app-int-api-service" -> (known after apply)
      ~ container_definitions    = jsonencode(
          ~ [
              ~ {
                  ~ Environment            = [
                        {
                            Name  = "APP_VERSION"
                            Value = "418eb0c"
                        },
                      ~ {
                          ~ Value = "int" -> "QA"
                            # (1 unchanged attribute hidden)
                        },
                    ]
                    # (39 unchanged attributes hidden)
                },
            ] # forces replacement
        )
      ~ id                       = "vol-app-int-api-service" -> (known after apply)
      ~ revision                 = 1 -> (known after apply)
      - tags                     = {} -> null
        # (12 unchanged attributes hidden)

        # (1 unchanged block hidden)
    }

  # module.service.module.ecs_service["internal"].data.aws_ecs_task_definition.this[0] will be read during apply
  # (depends on a resource or a module with changes pending)
 <= data "aws_ecs_task_definition" "this" {
      + arn                  = (known after apply)
      + arn_without_revision = (known after apply)
      + execution_role_arn   = (known after apply)
      + family               = (known after apply)
      + id                   = (known after apply)
      + network_mode         = (known after apply)
      + revision             = (known after apply)
      + status               = (known after apply)
      + task_definition      = "vol-app-int-internal-service"
      + task_role_arn        = (known after apply)
    }

  # module.service.module.ecs_service["internal"].aws_ecs_service.this[0] will be updated in-place
  ~ resource "aws_ecs_service" "this" {
        id                                 = "arn:aws:ecs:eu-west-1:054614622558:service/vol-app-int-internal-cluster/vol-app-int-internal-service"
        name                               = "vol-app-int-internal-service"
        tags                               = {}
      ~ task_definition                    = "vol-app-int-internal-service:1" -> (known after apply)
        # (16 unchanged attributes hidden)

        # (5 unchanged blocks hidden)
    }

  # module.service.module.ecs_service["internal"].aws_ecs_task_definition.this[0] must be replaced
+/- resource "aws_ecs_task_definition" "this" {
      ~ arn                      = "arn:aws:ecs:eu-west-1:054614622558:task-definition/vol-app-int-internal-service:1" -> (known after apply)
      ~ arn_without_revision     = "arn:aws:ecs:eu-west-1:054614622558:task-definition/vol-app-int-internal-service" -> (known after apply)
      ~ container_definitions    = jsonencode(
          ~ [
              ~ {
                  ~ Environment            = [
                        # (1 unchanged element hidden)
                        {
                            Name  = "CDN_URL"
                            Value = "d36shynblr0xo9.cloudfront.net"
                        },
                      ~ {
                          ~ Value = "int" -> "QA"
                            # (1 unchanged attribute hidden)
                        },
                    ]
                    # (39 unchanged attributes hidden)
                },
            ] # forces replacement
        )
      ~ id                       = "vol-app-int-internal-service" -> (known after apply)
      ~ revision                 = 1 -> (known after apply)
      - tags                     = {} -> null
        # (12 unchanged attributes hidden)

        # (1 unchanged block hidden)
    }

  # module.service.module.ecs_service["selfserve"].data.aws_ecs_task_definition.this[0] will be read during apply
  # (depends on a resource or a module with changes pending)
 <= data "aws_ecs_task_definition" "this" {
      + arn                  = (known after apply)
      + arn_without_revision = (known after apply)
      + execution_role_arn   = (known after apply)
      + family               = (known after apply)
      + id                   = (known after apply)
      + network_mode         = (known after apply)
      + revision             = (known after apply)
      + status               = (known after apply)
      + task_definition      = "vol-app-int-selfserve-service"
      + task_role_arn        = (known after apply)
    }

  # module.service.module.ecs_service["selfserve"].aws_ecs_service.this[0] will be updated in-place
  ~ resource "aws_ecs_service" "this" {
        id                                 = "arn:aws:ecs:eu-west-1:054614622558:service/vol-app-int-selfserve-cluster/vol-app-int-selfserve-service"
        name                               = "vol-app-int-selfserve-service"
        tags                               = {}
      ~ task_definition                    = "vol-app-int-selfserve-service:1" -> (known after apply)
        # (16 unchanged attributes hidden)

        # (5 unchanged blocks hidden)
    }

  # module.service.module.ecs_service["selfserve"].aws_ecs_task_definition.this[0] must be replaced
+/- resource "aws_ecs_task_definition" "this" {
      ~ arn                      = "arn:aws:ecs:eu-west-1:054614622558:task-definition/vol-app-int-selfserve-service:1" -> (known after apply)
      ~ arn_without_revision     = "arn:aws:ecs:eu-west-1:054614622558:task-definition/vol-app-int-selfserve-service" -> (known after apply)
      ~ container_definitions    = jsonencode(
          ~ [
              ~ {
                  ~ Environment            = [
                        # (1 unchanged element hidden)
                        {
                            Name  = "CDN_URL"
                            Value = "d36shynblr0xo9.cloudfront.net"
                        },
                      ~ {
                          ~ Value = "int" -> "QA"
                            # (1 unchanged attribute hidden)
                        },
                    ]
                    # (39 unchanged attributes hidden)
                },
            ] # forces replacement
        )
      ~ id                       = "vol-app-int-selfserve-service" -> (known after apply)
      ~ revision                 = 1 -> (known after apply)
      - tags                     = {} -> null
        # (12 unchanged attributes hidden)

        # (1 unchanged block hidden)
    }

Plan: 3 to add, 3 to change, 3 to destroy.

Copy link
Contributor

github-actions bot commented Aug 5, 2024

Terraform plan for environment: dev

Commit: f45fba3

API version: 418eb0c
CLI version: 418eb0c
Selfserve version: 418eb0c
Internal version: 418eb0c

Plan summary

3 to add, 4 to change, 0 to destroy

🆕 Creates

module.service.module.ecs_service["api"].aws_ecs_task_definition.this[0]
module.service.module.ecs_service["internal"].aws_ecs_task_definition.this[0]
module.service.module.ecs_service["selfserve"].aws_ecs_task_definition.this[0]

📖 Reads

module.service.module.ecs_service["api"].data.aws_ecs_task_definition.this[0]
module.service.module.ecs_service["internal"].data.aws_ecs_task_definition.this[0]
module.service.module.ecs_service["selfserve"].data.aws_ecs_task_definition.this[0]

🔄 Updates

module.service.aws_s3_bucket_policy.bucket_policy
module.service.module.ecs_service["api"].aws_ecs_service.this[0]
module.service.module.ecs_service["internal"].aws_ecs_service.this[0]
module.service.module.ecs_service["selfserve"].aws_ecs_service.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
+/- create replacement and then destroy
 <= read (data resources)

Terraform will perform the following actions:

  # module.service.aws_s3_bucket_policy.bucket_policy will be updated in-place
  ~ resource "aws_s3_bucket_policy" "bucket_policy" {
        id     = "vol-app-assets"
      ~ policy = jsonencode(
          ~ {
              ~ Statement = [
                  ~ {
                      ~ Condition = {
                          ~ StringEquals = {
                              ~ "aws:SourceArn" = "arn:aws:cloudfront::054614622558:distribution/E1GZYPKGUFNMP4" -> "arn:aws:cloudfront::054614622558:distribution/E3R9S2AKJG4ZTR"
                            }
                        }
                        # (4 unchanged attributes hidden)
                    },
                ]
                # (1 unchanged attribute hidden)
            }
        )
        # (1 unchanged attribute hidden)
    }

  # module.service.module.ecs_service["api"].data.aws_ecs_task_definition.this[0] will be read during apply
  # (depends on a resource or a module with changes pending)
 <= data "aws_ecs_task_definition" "this" {
      + arn                  = (known after apply)
      + arn_without_revision = (known after apply)
      + execution_role_arn   = (known after apply)
      + family               = (known after apply)
      + id                   = (known after apply)
      + network_mode         = (known after apply)
      + revision             = (known after apply)
      + status               = (known after apply)
      + task_definition      = "vol-app-dev-api-service"
      + task_role_arn        = (known after apply)
    }

  # module.service.module.ecs_service["api"].aws_ecs_service.this[0] will be updated in-place
  ~ resource "aws_ecs_service" "this" {
        id                                 = "arn:aws:ecs:eu-west-1:054614622558:service/vol-app-dev-api-cluster/vol-app-dev-api-service"
        name                               = "vol-app-dev-api-service"
        tags                               = {}
      ~ task_definition                    = "vol-app-dev-api-service:27" -> (known after apply)
        # (16 unchanged attributes hidden)

        # (5 unchanged blocks hidden)
    }

  # module.service.module.ecs_service["api"].aws_ecs_task_definition.this[0] must be replaced
+/- resource "aws_ecs_task_definition" "this" {
      ~ arn                      = "arn:aws:ecs:eu-west-1:054614622558:task-definition/vol-app-dev-api-service:27" -> (known after apply)
      ~ arn_without_revision     = "arn:aws:ecs:eu-west-1:054614622558:task-definition/vol-app-dev-api-service" -> (known after apply)
      ~ container_definitions    = jsonencode(
          ~ [
              ~ {
                  ~ Environment            = [
                        {
                            Name  = "APP_VERSION"
                            Value = "418eb0c"
                        },
                      ~ {
                          ~ Value = "dev" -> "DEV"
                            # (1 unchanged attribute hidden)
                        },
                    ]
                    # (39 unchanged attributes hidden)
                },
            ] # forces replacement
        )
      ~ id                       = "vol-app-dev-api-service" -> (known after apply)
      ~ revision                 = 27 -> (known after apply)
      - tags                     = {} -> null
        # (12 unchanged attributes hidden)

        # (1 unchanged block hidden)
    }

  # module.service.module.ecs_service["internal"].data.aws_ecs_task_definition.this[0] will be read during apply
  # (depends on a resource or a module with changes pending)
 <= data "aws_ecs_task_definition" "this" {
      + arn                  = (known after apply)
      + arn_without_revision = (known after apply)
      + execution_role_arn   = (known after apply)
      + family               = (known after apply)
      + id                   = (known after apply)
      + network_mode         = (known after apply)
      + revision             = (known after apply)
      + status               = (known after apply)
      + task_definition      = "vol-app-dev-internal-service"
      + task_role_arn        = (known after apply)
    }

  # module.service.module.ecs_service["internal"].aws_ecs_service.this[0] will be updated in-place
  ~ resource "aws_ecs_service" "this" {
        id                                 = "arn:aws:ecs:eu-west-1:054614622558:service/vol-app-dev-internal-cluster/vol-app-dev-internal-service"
        name                               = "vol-app-dev-internal-service"
        tags                               = {}
      ~ task_definition                    = "vol-app-dev-internal-service:21" -> (known after apply)
        # (16 unchanged attributes hidden)

        # (5 unchanged blocks hidden)
    }

  # module.service.module.ecs_service["internal"].aws_ecs_task_definition.this[0] must be replaced
+/- resource "aws_ecs_task_definition" "this" {
      ~ arn                      = "arn:aws:ecs:eu-west-1:054614622558:task-definition/vol-app-dev-internal-service:21" -> (known after apply)
      ~ arn_without_revision     = "arn:aws:ecs:eu-west-1:054614622558:task-definition/vol-app-dev-internal-service" -> (known after apply)
      ~ container_definitions    = jsonencode(
          ~ [
              ~ {
                  ~ Environment            = [
                        # (1 unchanged element hidden)
                        {
                            Name  = "CDN_URL"
                            Value = "d23zgifomtl7hu.cloudfront.net"
                        },
                      ~ {
                          ~ Value = "dev" -> "DEV"
                            # (1 unchanged attribute hidden)
                        },
                    ]
                    # (39 unchanged attributes hidden)
                },
            ] # forces replacement
        )
      ~ id                       = "vol-app-dev-internal-service" -> (known after apply)
      ~ revision                 = 21 -> (known after apply)
      - tags                     = {} -> null
        # (12 unchanged attributes hidden)

        # (1 unchanged block hidden)
    }

  # module.service.module.ecs_service["selfserve"].data.aws_ecs_task_definition.this[0] will be read during apply
  # (depends on a resource or a module with changes pending)
 <= data "aws_ecs_task_definition" "this" {
      + arn                  = (known after apply)
      + arn_without_revision = (known after apply)
      + execution_role_arn   = (known after apply)
      + family               = (known after apply)
      + id                   = (known after apply)
      + network_mode         = (known after apply)
      + revision             = (known after apply)
      + status               = (known after apply)
      + task_definition      = "vol-app-dev-selfserve-service"
      + task_role_arn        = (known after apply)
    }

  # module.service.module.ecs_service["selfserve"].aws_ecs_service.this[0] will be updated in-place
  ~ resource "aws_ecs_service" "this" {
        id                                 = "arn:aws:ecs:eu-west-1:054614622558:service/vol-app-dev-selfserve-cluster/vol-app-dev-selfserve-service"
        name                               = "vol-app-dev-selfserve-service"
        tags                               = {}
      ~ task_definition                    = "vol-app-dev-selfserve-service:22" -> (known after apply)
        # (16 unchanged attributes hidden)

        # (5 unchanged blocks hidden)
    }

  # module.service.module.ecs_service["selfserve"].aws_ecs_task_definition.this[0] must be replaced
+/- resource "aws_ecs_task_definition" "this" {
      ~ arn                      = "arn:aws:ecs:eu-west-1:054614622558:task-definition/vol-app-dev-selfserve-service:22" -> (known after apply)
      ~ arn_without_revision     = "arn:aws:ecs:eu-west-1:054614622558:task-definition/vol-app-dev-selfserve-service" -> (known after apply)
      ~ container_definitions    = jsonencode(
          ~ [
              ~ {
                  ~ Environment            = [
                        # (1 unchanged element hidden)
                        {
                            Name  = "CDN_URL"
                            Value = "d23zgifomtl7hu.cloudfront.net"
                        },
                      ~ {
                          ~ Value = "dev" -> "DEV"
                            # (1 unchanged attribute hidden)
                        },
                    ]
                    # (39 unchanged attributes hidden)
                },
            ] # forces replacement
        )
      ~ id                       = "vol-app-dev-selfserve-service" -> (known after apply)
      ~ revision                 = 22 -> (known after apply)
      - tags                     = {} -> null
        # (12 unchanged attributes hidden)

        # (1 unchanged block hidden)
    }

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

@JoshuaLicense JoshuaLicense merged commit 124e0fc into main Aug 5, 2024
19 checks passed
@JoshuaLicense JoshuaLicense deleted the pass-legacy-env-through-to-service-module branch August 5, 2024 17:56
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.

2 participants