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

aws_ebs_default_kms_key returns invalid key_arn #15137

Closed
alekna opened this issue Sep 13, 2020 · 5 comments
Closed

aws_ebs_default_kms_key returns invalid key_arn #15137

alekna opened this issue Sep 13, 2020 · 5 comments
Labels
documentation Introduces or discusses updates to documentation. service/ec2 Issues and PRs that pertain to the ec2 service. stale Old or inactive issues managed by automation, if no further action taken these will get closed. upstream Addresses functionality related to the cloud provider.

Comments

@alekna
Copy link

alekna commented Sep 13, 2020

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • 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
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform CLI and Terraform AWS Provider Version

$ terraform version
Terraform v0.13.2
+ provider registry.terraform.io/hashicorp/aws v3.6.0

Affected Resource(s)

  • aws_ebs_default_kms_key
  • aws_ebs_volume

Terraform Configuration Files

As per example on https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/ebs_default_kms_key

data "aws_ebs_default_kms_key" "current" {}

resource "aws_ebs_volume" "example" {
  availability_zone = "us-west-2a"

  encrypted  = true
  kms_key_id = data.aws_ebs_default_kms_key.current.key_arn
}

Expected Behavior

  • encrypted EBS volume is created

Actual Behavior

$ terraform apply
data.aws_ebs_default_kms_key.current: Refreshing state...

Error: "kms_key_id" (alias/aws/ebs) is an invalid ARN: arn: invalid prefix

  on ec2.tf line 21, in resource "aws_ebs_volume" "example":
  21:   kms_key_id = data.aws_ebs_default_kms_key.current.key_arn

Steps to Reproduce

  1. terraform apply
@ghost ghost added the service/ec2 Issues and PRs that pertain to the ec2 service. label Sep 13, 2020
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Sep 13, 2020
@karnauskas
Copy link

Looks like AWS API which returns it: <kmsKeyId>alias/aws/ebs</kmsKeyId> if default key is managed by AWS.
You can work around this with:

data "aws_ebs_default_kms_key" "current" {}

data "aws_kms_key" "current" {
  key_id = data.aws_ebs_default_kms_key.current.key_arn
}

resource "aws_ebs_volume" "example" {
  availability_zone = "us-west-2a"

  encrypted  = true
  kms_key_id = data.aws_kms_key.current.arn
}

@anGie44 anGie44 removed the needs-triage Waiting for first response or review from a maintainer. label Sep 14, 2020
@anGie44
Copy link
Contributor

anGie44 commented Sep 14, 2020

Related #13860

@anGie44 anGie44 added upstream Addresses functionality related to the cloud provider. bug Addresses a defect in current functionality. labels Sep 14, 2020
@anGie44
Copy link
Contributor

anGie44 commented Sep 14, 2020

Hi @alekna, thank you for creating this issue! Given the upstream behavior @karnauskas mentioned above, we can plan to document this behavior in the data-source docs to capture this use case. In the meantime I've provided feedback to the EC2 service team's API documentation.

@anGie44 anGie44 added the documentation Introduces or discusses updates to documentation. label Sep 14, 2020
@anGie44 anGie44 removed the bug Addresses a defect in current functionality. label Sep 15, 2020
@github-actions
Copy link

github-actions bot commented Sep 6, 2022

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!

@github-actions github-actions bot added the stale Old or inactive issues managed by automation, if no further action taken these will get closed. label Sep 6, 2022
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Oct 6, 2022
@github-actions
Copy link

github-actions bot commented Nov 6, 2022

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 6, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Introduces or discusses updates to documentation. service/ec2 Issues and PRs that pertain to the ec2 service. stale Old or inactive issues managed by automation, if no further action taken these will get closed. upstream Addresses functionality related to the cloud provider.
Projects
None yet
Development

No branches or pull requests

3 participants