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): set container definition user to null #98

Merged
merged 2 commits into from
May 1, 2024

Conversation

JoshuaLicense
Copy link
Contributor

Description

Sets the user in the container definition to null rather than 0 which is root. null will use the USER directive in the image instead.

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 1, 2024
Copy link
Contributor

github-actions bot commented May 1, 2024

Terraform plan for environment: int

Commit: b29a1bf

API version: 878c50d
Selfserve version: 878c50d
Internal version: 878c50d

Plan summary

0 to add, 0 to change, 0 to destroy


Show full plan
No changes. Your infrastructure matches the configuration.

Terraform has compared your real infrastructure against your configuration
and found no differences, so no changes are needed.

Copy link
Contributor

github-actions bot commented May 1, 2024

Terraform plan for environment: dev

Commit: b29a1bf

API version: 878c50d
Selfserve version: 878c50d
Internal version: 878c50d

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:13" -> (known after apply)
        # (16 unchanged attributes hidden)

        # (4 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:13" -> (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(
          ~ [
              ~ {
                    name                   = "api"
                  - user                   = "0"
                    # (18 unchanged attributes hidden)
                },
            ] # forces replacement
        )
      ~ id                       = "vol-app-dev-api-service" -> (known after apply)
      ~ revision                 = 13 -> (known after apply)
      - tags                     = {} -> null
      ~ tags_all                 = {} -> (known after apply)
        # (11 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:7" -> (known after apply)
        # (16 unchanged attributes hidden)

        # (4 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:7" -> (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(
          ~ [
              ~ {
                    name                   = "internal"
                  - user                   = "0"
                    # (18 unchanged attributes hidden)
                },
            ] # forces replacement
        )
      ~ id                       = "vol-app-dev-internal-service" -> (known after apply)
      ~ revision                 = 7 -> (known after apply)
      - tags                     = {} -> null
      ~ tags_all                 = {} -> (known after apply)
        # (11 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:7" -> (known after apply)
        # (16 unchanged attributes hidden)

        # (4 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:7" -> (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(
          ~ [
              ~ {
                    name                   = "selfserve"
                  - user                   = "0"
                    # (18 unchanged attributes hidden)
                },
            ] # forces replacement
        )
      ~ id                       = "vol-app-dev-selfserve-service" -> (known after apply)
      ~ revision                 = 7 -> (known after apply)
      - tags                     = {} -> null
      ~ tags_all                 = {} -> (known after apply)
        # (11 unchanged attributes hidden)

        # (1 unchanged block hidden)
    }

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

@JoshuaLicense JoshuaLicense merged commit 6369ca4 into main May 1, 2024
@JoshuaLicense JoshuaLicense deleted the fix-container-running-as-root branch May 1, 2024 11:11
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