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: add Elasticache as session save handler #304

Merged
merged 1 commit into from
Sep 3, 2024

Conversation

JoshuaLicense
Copy link
Contributor

Description

Points the app to use the redis cache as a session store.

Related issue: https://dvsa.atlassian.net/browse/VOL-5775

@JoshuaLicense JoshuaLicense self-assigned this Sep 3, 2024
Copy link
Contributor

github-actions bot commented Sep 3, 2024

Terraform plan for environment: int

Commit: 6165acf

API version: 2791b9c
CLI version: 2791b9c
Selfserve version: 6165acf
Internal version: 6165acf

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:22" -> (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:22" -> (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 = "2791b9c135"
                        },
                      + {
                          + name  = "ELASTICACHE_URL"
                          + value = "tcp://cache.qa.olcs.dev-dvsacloud.uk:6379"
                        },
                        {
                            name  = "ENVIRONMENT_NAME"
                            value = "QA"
                        },
                    ]
                    name                   = "api"
                    # (17 unchanged attributes hidden)
                },
            ] # forces replacement
        )
      ~ id                       = "vol-app-int-api-service" -> (known after apply)
      ~ revision                 = 22 -> (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:16" -> (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:16" -> (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            = [
                      ~ {
                            name  = "APP_VERSION"
                          ~ value = "6b844f144a" -> "6165acf4bc"
                        },
                        {
                            name  = "CDN_URL"
                            value = "d36shynblr0xo9.cloudfront.net"
                        },
                      + {
                          + name  = "ELASTICACHE_URL"
                          + value = "tcp://cache.qa.olcs.dev-dvsacloud.uk:6379"
                        },
                        {
                            name  = "ENVIRONMENT_NAME"
                            value = "QA"
                        },
                    ]
                  ~ image                  = "054614622558.dkr.ecr.eu-west-1.amazonaws.com/vol-app/internal:6b844f144a" -> "054614622558.dkr.ecr.eu-west-1.amazonaws.com/vol-app/internal:6165acf4bc"
                    name                   = "internal"
                    # (16 unchanged attributes hidden)
                },
            ] # forces replacement
        )
      ~ id                       = "vol-app-int-internal-service" -> (known after apply)
      ~ revision                 = 16 -> (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:19" -> (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:19" -> (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            = [
                      ~ {
                            name  = "APP_VERSION"
                          ~ value = "d1eb15fb7f" -> "6165acf4bc"
                        },
                        {
                            name  = "CDN_URL"
                            value = "d36shynblr0xo9.cloudfront.net"
                        },
                      + {
                          + name  = "ELASTICACHE_URL"
                          + value = "tcp://cache.qa.olcs.dev-dvsacloud.uk:6379"
                        },
                        {
                            name  = "ENVIRONMENT_NAME"
                            value = "QA"
                        },
                    ]
                  ~ image                  = "054614622558.dkr.ecr.eu-west-1.amazonaws.com/vol-app/selfserve:d1eb15fb7f" -> "054614622558.dkr.ecr.eu-west-1.amazonaws.com/vol-app/selfserve:6165acf4bc"
                    name                   = "selfserve"
                    # (16 unchanged attributes hidden)
                },
            ] # forces replacement
        )
      ~ id                       = "vol-app-int-selfserve-service" -> (known after apply)
      ~ revision                 = 19 -> (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 Sep 3, 2024

Terraform plan for environment: dev

Commit: 6165acf

API version: 2791b9c
CLI version: 2791b9c
Selfserve version: 6165acf
Internal version: 6165acf

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-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:49" -> (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:49" -> (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 = "2791b9c135"
                        },
                      + {
                          + name  = "ELASTICACHE_URL"
                          + value = "tcp://cache.dev.olcs.dev-dvsacloud.uk:6379"
                        },
                        {
                            name  = "ENVIRONMENT_NAME"
                            value = "DEV"
                        },
                    ]
                    name                   = "api"
                    # (17 unchanged attributes hidden)
                },
            ] # forces replacement
        )
      ~ id                       = "vol-app-dev-api-service" -> (known after apply)
      ~ revision                 = 49 -> (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:37" -> (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:37" -> (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            = [
                      ~ {
                            name  = "APP_VERSION"
                          ~ value = "6b844f144a" -> "6165acf4bc"
                        },
                        {
                            name  = "CDN_URL"
                            value = "d23zgifomtl7hu.cloudfront.net"
                        },
                      + {
                          + name  = "ELASTICACHE_URL"
                          + value = "tcp://cache.dev.olcs.dev-dvsacloud.uk:6379"
                        },
                        {
                            name  = "ENVIRONMENT_NAME"
                            value = "DEV"
                        },
                    ]
                  ~ image                  = "054614622558.dkr.ecr.eu-west-1.amazonaws.com/vol-app/internal:6b844f144a" -> "054614622558.dkr.ecr.eu-west-1.amazonaws.com/vol-app/internal:6165acf4bc"
                    name                   = "internal"
                    # (16 unchanged attributes hidden)
                },
            ] # forces replacement
        )
      ~ id                       = "vol-app-dev-internal-service" -> (known after apply)
      ~ revision                 = 37 -> (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:41" -> (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:41" -> (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            = [
                      ~ {
                            name  = "APP_VERSION"
                          ~ value = "d1eb15fb7f" -> "6165acf4bc"
                        },
                        {
                            name  = "CDN_URL"
                            value = "d23zgifomtl7hu.cloudfront.net"
                        },
                      + {
                          + name  = "ELASTICACHE_URL"
                          + value = "tcp://cache.dev.olcs.dev-dvsacloud.uk:6379"
                        },
                        {
                            name  = "ENVIRONMENT_NAME"
                            value = "DEV"
                        },
                    ]
                  ~ image                  = "054614622558.dkr.ecr.eu-west-1.amazonaws.com/vol-app/selfserve:d1eb15fb7f" -> "054614622558.dkr.ecr.eu-west-1.amazonaws.com/vol-app/selfserve:6165acf4bc"
                    name                   = "selfserve"
                    # (16 unchanged attributes hidden)
                },
            ] # forces replacement
        )
      ~ id                       = "vol-app-dev-selfserve-service" -> (known after apply)
      ~ revision                 = 41 -> (known after apply)
      - tags                     = {} -> null
        # (12 unchanged attributes hidden)

        # (1 unchanged block hidden)
    }

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

@JoshuaLicense JoshuaLicense marked this pull request as ready for review September 3, 2024 13:36
@JoshuaLicense JoshuaLicense requested a review from a team as a code owner September 3, 2024 13:36
@JoshuaLicense JoshuaLicense merged commit 20df1db into main Sep 3, 2024
27 checks passed
@JoshuaLicense JoshuaLicense deleted the use-elasticache-as-session-save-handler branch September 3, 2024 13: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