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

provider/aws: Add aws_kms_alias datasource #13669

Merged
merged 1 commit into from
Apr 18, 2017

Conversation

kjmkznr
Copy link
Contributor

@kjmkznr kjmkznr commented Apr 14, 2017

This datasource can get arn of KMS key alias.

$  make test TEST=./builtin/providers/aws/
==> Checking that code complies with gofmt requirements...
==> Checking AWS provider for unchecked errors...
==> NOTE: at this time we only look for uncheck errors in the AWS package
go generate $(go list ./... | grep -v /terraform/vendor/)
2017/04/15 03:20:50 Generated command/internal_plugin_list.go
go test -i ./builtin/providers/aws/ || exit 1
echo ./builtin/providers/aws/ | \
        xargs -t -n4 go test  -timeout=60s -parallel=4
go test -timeout=60s -parallel=4 ./builtin/providers/aws/
ok      github.com/hashicorp/terraform/builtin/providers/aws    1.671s

$ make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccDataSourceAwsKmsAlias'
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /terraform/vendor/)
2017/04/15 03:16:14 Generated command/internal_plugin_list.go
TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccDataSourceAwsKmsAlias -timeout 120m
=== RUN   TestAccDataSourceAwsKmsAlias
--- PASS: TestAccDataSourceAwsKmsAlias (68.02s)
PASS
ok      github.com/hashicorp/terraform/builtin/providers/aws    68.031s

@stack72
Copy link
Contributor

stack72 commented Apr 18, 2017

LGTM! thanks for this :)

% make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccDataSourceAwsKmsAlias'            ✭
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /terraform/vendor/)
2017/04/18 15:26:47 Generated command/internal_plugin_list.go
TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccDataSourceAwsKmsAlias -timeout 120m
=== RUN   TestAccDataSourceAwsKmsAlias
--- PASS: TestAccDataSourceAwsKmsAlias (72.56s)
PASS
ok  	github.com/hashicorp/terraform/builtin/providers/aws	72.583s

@stack72 stack72 merged commit 47d255f into hashicorp:master Apr 18, 2017
@riponbanik
Copy link

riponbanik commented Aug 10, 2017

using data source for kms_key_id in cloudtrail like below causes to update resource each time terraform is run
kms_key_id = "${data.aws_kms_alias.cloudtrail.arn}"

When I look at the data tfstate it shows the arn of the alias, instead of key
arn:aws:kms:ap-southeast-2:xxx:alias/xxxx

Doing as wokaround as -

arn:aws:kms:${var.aws_region}:${data.aws_caller_identity.default.account_id}:key/${data.aws_kms_alias.cloudtrail.target_key_id}

@ghost
Copy link

ghost commented Apr 7, 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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Apr 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants