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]: KMS grant tokens not marked as sensitive #36450

Closed
apgrucza opened this issue Mar 19, 2024 · 3 comments · Fixed by #37593
Closed

[Bug]: KMS grant tokens not marked as sensitive #36450

apgrucza opened this issue Mar 19, 2024 · 3 comments · Fixed by #37593
Labels
bug Addresses a defect in current functionality. service/kms Issues and PRs that pertain to the kms service.
Milestone

Comments

@apgrucza
Copy link

apgrucza commented Mar 19, 2024

Terraform Core Version

1.7.4

AWS Provider Version

4.67.0

Affected Resource(s)

aws_kms_grant

Expected Behavior

grant_creation_tokens and grant_token should be marked as sensitive so that they are always redacted in Terraform output.

Actual Behavior

The value of grant_token was visible when running `terraform destroy'.

Relevant Error/Panic Output Snippet

No response

Terraform Configuration Files

variable "custom_suffix" {
  default     = null
  description = "Additional string appended to the role names that support custom suffixes"
}

variable "ami_kms_key_arn" {
  description = "The ARN of the KMS Key used to encrypt the AMI"
  type        = string
}

data "aws_caller_identity" "current" {}

# Grant the Auto Scaling role access to the KMS keys used to encrypt the AMIs
resource "aws_kms_grant" "kms_asg_grant" {
  name              = "kms-asg-grant-account-ami-${var.custom_suffix}"
  key_id            = var.ami_kms_key_arn
  grantee_principal = "arn:aws:iam::${data.aws_caller_identity.current.account_id}:role/aws-service-role/autoscaling.amazonaws.com/${aws_iam_service_linked_role.autoscaling_service.name}"
  operations = [
    "Encrypt",
    "Decrypt",
    "ReEncryptFrom",
    "ReEncryptTo",
    "GenerateDataKey",
    "GenerateDataKeyWithoutPlaintext",
    "DescribeKey",
    "CreateGrant"
  ]
}

# Auto Scaling service-linked role
resource "aws_iam_service_linked_role" "autoscaling_service" {
  aws_service_name = "autoscaling.amazonaws.com"
  custom_suffix    = var.custom_suffix
  description      = "Allows EC2 Auto Scaling to use or manage AWS services and resources on your behalf."
}

Steps to Reproduce

  1. Run terraform apply, providing values for variables custom_suffix and ami_kms_key_arn.
  2. Run terraform destroy and observe the value of grant_token being displayed in the output.

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

No

@apgrucza apgrucza added the bug Addresses a defect in current functionality. label Mar 19, 2024
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 service/iam Issues and PRs that pertain to the iam service. service/kms Issues and PRs that pertain to the kms service. service/sts Issues and PRs that pertain to the sts service. labels Mar 19, 2024
@terraform-aws-provider terraform-aws-provider bot added the needs-triage Waiting for first response or review from a maintainer. label Mar 19, 2024
@justinretzolk justinretzolk removed service/iam Issues and PRs that pertain to the iam service. service/sts Issues and PRs that pertain to the sts service. needs-triage Waiting for first response or review from a maintainer. labels Mar 19, 2024
Copy link

Warning

This issue has been closed, meaning that any additional comments are hard for our team to see. Please assume that the maintainers will not see them.

Ongoing conversations amongst community members are welcome, however, the issue will be locked after 30 days. Moving conversations to another venue, such as the AWS Provider forum, is recommended. If you have additional concerns, please open a new issue, referencing this one where needed.

@github-actions github-actions bot added this to the v5.51.0 milestone May 20, 2024
Copy link

This functionality has been released in v5.51.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

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/kms Issues and PRs that pertain to the kms service.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants