Closed rileydak closed 2 weeks ago
example TF Template with scenario of after_unknown value: ` resource "aws_kms_key" "kms_key" { description = "KMS key 1" deletion_window_in_days = 10 }
data "aws_iam_policy_document" "iam_policy_document" { statement { effect = "Allow" actions = ["kms:*"] resources = ["${aws_kms_key.kms_key.arn}"] } }
resource "aws_iam_policy" "iam_policy" { name = "iam_policy" policy = "${data.aws_iam_policy_document.iam_policy_document.json}"
} `
resulting output of plan ` # aws_iam_policy.iam_policy will be created
Marking this issue as stale due to inactivity. This helps our maintainers find and focus on the active issues. If this issue receives no comments in the next 30 days it will automatically be closed. Maintainers can also remove the stale label.
If this issue was automatically closed and you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thank you!
When generating a plan file to json output using the following commands:
terraform plan -out planfile terraform show -json planfile
attributes about the specific resources being changed can be found in the ['resource_changes'] key of the terraform plan file.
Some values for resource_changes can appear in the after_unknown field. The best example of this is referencing a KMS Key ARN for a key being created within the same template in the IAM Policy. This causes the entire policy to appear in the "after_unknown" key - as opposed to containing the policy document. The terraform plan output to json capability is a great feature to allow programmatic parsing of terraform plans. However - without better understanding of when specifically certain values will be treated as after_unknown, can it be relied upon for checking templates for compliance?
Requesting that the exact causes of this be documented to be better understood by the community.
Community Note
Description
New or Affected Resource(s)
Potential Terraform Configuration
References
0000