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

[Bug]: tags_all is showing sensitive data #30278

Open
askmike1 opened this issue Mar 27, 2023 · 1 comment
Open

[Bug]: tags_all is showing sensitive data #30278

askmike1 opened this issue Mar 27, 2023 · 1 comment
Labels
bug Addresses a defect in current functionality. service/iam Issues and PRs that pertain to the iam service. tags Pertains to resource tagging.

Comments

@askmike1
Copy link

askmike1 commented Mar 27, 2023

Terraform Core Version

1.4.2

AWS Provider Version

4.0

Affected Resource(s)

aws_iam_policy

Expected Behavior

tags_all should not show sensitive data

Actual Behavior

Sensitive data is shown for tags_all (shows as "sensitive data" for tags and policy)

Relevant Error/Panic Output Snippet

[ DONE ] Setting Terraform Version to: 1.4.2


TERRAFORM PLAN ON TEST

module.global-config.data.consul_key_prefix.globals: Reading...
module.global-config.data.consul_key_prefix.globals: Read complete after 0s [id=-]
data.vault_generic_secret.config_secret: Reading...
data.vault_generic_secret.config_secret: Read complete after 0s [id=secret_v2/ee/csm/search-loader2/us-east-1/latest]

Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # aws_iam_policy.policy will be created
  + resource "aws_iam_policy" "policy" {
      + arn         = (known after apply)
      + description = "My test policy"
      + id          = (known after apply)
      + name        = "test_policy12354"
      + path        = "/"
      + policy      = (sensitive value)
      + policy_id   = (known after apply)
      + tags        = {
          + "test"         = (sensitive value)
        }
      + tags_all    = {
          + "test"         = "ES_ACCESS_KEY=aaa,ES_DOMAIN=bbb,ES_HOST=ccc,ES_REGION=ddd,ES_SECRET_KEY=eee,STORES=fff"
        }
    }

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

Changes to Outputs:
  + test = (sensitive value)

Terraform Configuration Files

provider "aws" {
  region  = var.region
  assume_role {
    role_arn     = format("arn:aws:iam::%s:role/%s", local.account_id, var.provider_assumed_role)
    session_name = var.se_contact
  }
}

provider "vault" {
  address                = length(var.terraform) > 0 ? (var.service == "" ? "" : (var.vault_addr_override == "" ? format("https://%svault-%s.xyz.com", local.vault_prefix, local.vault_short_region) : var.vault_addr_override)) : ""
}

data "vault_generic_secret" "config_secret" {
  path            = "${local.vault_secrets_mount}/x/y/z"
}

resource "aws_iam_policy" "policy" {
  name        = "test_policy12354"
  path        = "/"
  description = "My test policy"
  
  tags = {
    "test" = join(",", [for key, value in data.vault_generic_secret.config_secret.data : "${key}=${value}"])
  }

  # Terraform's "jsonencode" function converts a
  # Terraform expression result to valid JSON syntax.
  policy = jsonencode({
    Secret = "${join(",", [for key, value in data.vault_generic_secret.config_secret.data : "${key}=${value}"])}"
    Version = "2012-10-17"
    Statement = [
      {
        Action = [
          "ec2:Describe",
        ]
        Effect   = "Allow"
        Resource = "*"
      },
    ]
  })
}

Steps to Reproduce

Have variable or resource with sensitive data

Create iam_policy with the output of that sensitive data as a tag

Run an init/plan

Note that tags in output shows (sensitive data) while tags_all shows the actual contents

Debug Output

N/A

Panic Output

N/A

Important Factoids

N/A

References

N/A

Would you like to implement a fix?

No

@askmike1 askmike1 added bug Addresses a defect in current functionality. needs-triage Waiting for first response or review from a maintainer. labels Mar 27, 2023
@github-actions
Copy link

Community Note

Voting for Prioritization

  • Please vote on this issue by adding a 👍 reaction to the original post to help the community and maintainers prioritize this request.
  • Please see our prioritization guide for information on how we prioritize.
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.

Volunteering to Work on This Issue

  • If you are interested in working on this issue, please leave a comment.
  • If this would be your first contribution, please review the contribution guide.

@github-actions github-actions bot added the service/iam Issues and PRs that pertain to the iam service. label Mar 27, 2023
@justinretzolk justinretzolk added tags Pertains to resource tagging. and removed needs-triage Waiting for first response or review from a maintainer. labels Apr 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Addresses a defect in current functionality. service/iam Issues and PRs that pertain to the iam service. tags Pertains to resource tagging.
Projects
None yet
Development

No branches or pull requests

2 participants