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_kms_public_key.public_key returning malformed data #20595

Closed
chrisclayson opened this issue Aug 17, 2021 · 2 comments · Fixed by #19944
Closed

aws_kms_public_key.public_key returning malformed data #20595

chrisclayson opened this issue Aug 17, 2021 · 2 comments · Fixed by #19944
Labels
bug Addresses a defect in current functionality. service/kms Issues and PRs that pertain to the kms service.
Milestone

Comments

@chrisclayson
Copy link

chrisclayson commented Aug 17, 2021

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 v1.0.0
on darwin_amd64
+ provider registry.terraform.io/hashicorp/aws v3.54.0

Affected Resource(s)

  • aws_kms_public_key

Terraform Configuration Files

resource "aws_kms_key" "key" {
  description              = "My Key"
  deletion_window_in_days  = 30
  key_usage                = "SIGN_VERIFY"
  customer_master_key_spec = "RSA_2048"
}

data "aws_kms_public_key" "key" {
  depends_on = [aws_kms_key.key]
  key_id = aws_kms_key.key.arn
}

output "public_key" {
  value = {
    public_key = data.aws_kms_public_key.key.public_key
    algs = data.aws_kms_public_key.key.signing_algorithms
    usage = data.aws_kms_public_key.key.key_usage
  }
}

Expected Behavior

According to the docs the public_key attribute should have returned the base64 encoded DER public key as received in the PublicKey attribute returned by the API call.

Actual Behavior

The public_key attribute returns a binary value, which doesn't even seem to be the raw DER, as if I base64encode it, it still isn't the correct value :-(

I have compared with the output of aws kms get-public-key --key-id <key-id> and by viewing the public key in the AWS console.

All other attributes returned by this data source seem to be correct.

Steps to Reproduce

  1. terraform apply
@github-actions github-actions bot added needs-triage Waiting for first response or review from a maintainer. service/kms Issues and PRs that pertain to the kms service. labels Aug 17, 2021
@ewbankkit ewbankkit added bug Addresses a defect in current functionality. and removed needs-triage Waiting for first response or review from a maintainer. labels Aug 17, 2021
chrisclayson added a commit to govuk-one-login/authentication-api that referenced this issue Aug 18, 2021
- Provision a KMS CMK for account management
- Generate a random client ID
- Add client to DynamoDB table with placeholder for public key (workaround until hashicorp/terraform-provider-aws#20595 is resolved)
- Output details so they can be injected into the account management PaaS app
chrisclayson added a commit to govuk-one-login/authentication-api that referenced this issue Aug 18, 2021
- Provision a KMS CMK for account management
- Generate a random client ID
- Add client to DynamoDB table with placeholder for public key (workaround until hashicorp/terraform-provider-aws#20595 is resolved)
- Output details so they can be injected into the account management PaaS app
@github-actions github-actions bot added this to the v3.56.0 milestone Aug 25, 2021
@github-actions
Copy link

This functionality has been released in v3.56.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!

chrisclayson added a commit to govuk-one-login/di-account-management-frontend that referenced this issue Sep 7, 2021
- The Terraform AWS provider bug (hashicorp/terraform-provider-aws#20595) has been fixed, use the `aws_kms_public_key` provider now, as originally planned, and remove the workaround that was added to the pipeline.
@github-actions
Copy link

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 Jun 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
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