Skip to content

AWS ECS Container definition environments do not get masked #30

@monemihir

Description

@monemihir

Environment variables passed to AWS ECS container definition do not get masked

export TFMASK_CHAR="#"
export TFMASK_VALUES_REGEX="(?i)^.*[^a-zA-Z](oauth|password|pass_for_service|pass_|passwd|key|result|id).*$"

Actual

[2021-10-21T07:03:02Z]   + resource "aws_ecs_task_definition" "main_task" {
--
  | [2021-10-21T07:03:02Z]       + arn                   = (known after apply)
  | [2021-10-21T07:03:02Z]       + container_definitions = jsonencode(
  | [2021-10-21T07:03:02Z]             [
  | [2021-10-21T07:03:02Z]               + {
  | [2021-10-21T07:03:02Z]                   + cpu               = 192
  | [2021-10-21T07:03:02Z]                   + environment       = [
  | [2021-10-21T07:03:02Z]                       + {
  | [2021-10-21T07:03:02Z]                           + name  = "ENVIRONMENT"
  | [2021-10-21T07:03:02Z]                           + value = "sandpit"
  | [2021-10-21T07:03:02Z]                         },
  | [2021-10-21T07:03:02Z]                       + {
  | [2021-10-21T07:03:02Z]                           + name  = "PASS_FOR_SERVICE"
  | [2021-10-21T07:03:02Z]                           + value = "abkjcdksj3892jjw"
  | [2021-10-21T07:03:02Z]                         },
 | [2021-10-21T07:03:02Z]                     ]
...

Expected

[2021-10-21T07:03:02Z]   + resource "aws_ecs_task_definition" "main_task" {
--
  | [2021-10-21T07:03:02Z]       + arn                   = (known after apply)
  | [2021-10-21T07:03:02Z]       + container_definitions = jsonencode(
  | [2021-10-21T07:03:02Z]             [
  | [2021-10-21T07:03:02Z]               + {
  | [2021-10-21T07:03:02Z]                   + cpu               = 192
  | [2021-10-21T07:03:02Z]                   + environment       = [
  | [2021-10-21T07:03:02Z]                       + {
  | [2021-10-21T07:03:02Z]                           + name  = "ENVIRONMENT"
  | [2021-10-21T07:03:02Z]                           + value = "sandpit"
  | [2021-10-21T07:03:02Z]                         },
  | [2021-10-21T07:03:02Z]                       + {
  | [2021-10-21T07:03:02Z]                           + name  = "PASS_FOR_SERVICE"
  | [2021-10-21T07:03:02Z]                           + value = "#################"
  | [2021-10-21T07:03:02Z]                         },
 | [2021-10-21T07:03:02Z]                     ]
...

I am using the latest version of tfmask

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions