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

resource/aws_kms_alias: Fix perpetual plan when target_key_id is ARN #4010

Merged
merged 2 commits into from
Jun 29, 2018

Conversation

carinadigital
Copy link
Contributor

An aws_kms_alias resource target_key_id can be set to either key_id or ARN. When it's set to ARN, then the resource is correctly created, but then a perpetual plan exists.

 ~ aws_kms_alias.mykey
     target_key_id: "abcde123-1234-1234-1234-12345678901" => "arn:aws:kms:eu-west-1:123456789123:key/abcde123-1234-1234-1234-12345678901"

@ghost ghost added the size/M Managed by automation to categorize the size of a PR. label Apr 2, 2018
@carinadigital
Copy link
Contributor Author

Test added to check for plan being not empty.

F_ACC=1 go test ./... -v -run=TestAccAWSKmsAlias_ArnDiffSuppress -timeout 120m
?       github.com/terraform-providers/terraform-provider-aws   [no test files]
=== RUN   TestAccAWSKmsAlias_ArnDiffSuppress
--- FAIL: TestAccAWSKmsAlias_ArnDiffSuppress (70.20s)
        testing.go:518: Step 0 error: After applying this step, the plan was not empty:

                DIFF:

                UPDATE: aws_kms_alias.bar
                  target_key_id: "b33dfb04-1392-4fd4-84f6-8d0d6c2c1725" => "arn:aws:kms:us-west-2:238302996107:key/b33dfb04-1392-4fd4-84f6-8d0d
6c2c1725"

@carinadigital
Copy link
Contributor Author

A example plan that creates a perpetual diff with Terraform v0.11.3 & provider.aws v1.13.0

resource "aws_kms_key" "mykey" {
  description = "KMS key 1"
}

resource "aws_kms_alias" "myalias" {
  name          = "alias/my-key-alias"
  target_key_id = "${aws_kms_key.mykey.arn}"

@bflad bflad added enhancement Requests to existing resources that expand the functionality or scope. service/kms Issues and PRs that pertain to the kms service. labels Apr 2, 2018
Copy link
Contributor

@bflad bflad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM -- thanks so much @carinadigital! 🚀

6 tests passed (all tests)
=== RUN   TestAccAWSKmsAlias_multiple
--- PASS: TestAccAWSKmsAlias_multiple (26.85s)
=== RUN   TestAccAWSKmsAlias_no_name
--- PASS: TestAccAWSKmsAlias_no_name (28.87s)
=== RUN   TestAccAWSKmsAlias_name_prefix
--- PASS: TestAccAWSKmsAlias_name_prefix (29.68s)
=== RUN   TestAccAWSKmsAlias_importBasic
--- PASS: TestAccAWSKmsAlias_importBasic (30.49s)
=== RUN   TestAccAWSKmsAlias_ArnDiffSuppress
--- PASS: TestAccAWSKmsAlias_ArnDiffSuppress (30.59s)
=== RUN   TestAccAWSKmsAlias_basic
--- PASS: TestAccAWSKmsAlias_basic (31.72s)

@bflad bflad added this to the v1.26.0 milestone Jun 29, 2018
@bflad bflad merged commit 0b8a91f into hashicorp:master Jun 29, 2018
bflad added a commit that referenced this pull request Jun 29, 2018
@bflad
Copy link
Contributor

bflad commented Jul 4, 2018

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

@ghost
Copy link

ghost commented Apr 4, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked and limited conversation to collaborators Apr 4, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/kms Issues and PRs that pertain to the kms service. size/M Managed by automation to categorize the size of a PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants