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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix secret_binary in secret_version datasource #25758

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

wedge-jarrad
Copy link
Contributor

Base64 encode the returned binary secret. This is consistant with how the
binary secret is supplied to the resource and with how the resource itself
represents the binary data. Simply casting the binary data to a string doesn't
appear to result in anything usable.

Community Note

  • Please vote on this pull request by adding a 馃憤 reaction to the original pull request comment 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 pull request followers and do not help prioritize the request

Closes #25603

Output from acceptance testing:

$ gmake testacc TESTS='TestAccSecretsManagerSecretVersionDataSource*' PKG=secretsmanager
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/secretsmanager/... -v -count 1 -parallel 20 -run='TestAccSecretsManagerSecretVersionDataSource*'  -timeout 180m
=== RUN   TestAccSecretsManagerSecretVersionDataSource_basic
=== PAUSE TestAccSecretsManagerSecretVersionDataSource_basic
=== RUN   TestAccSecretsManagerSecretVersionDataSource_binary
=== PAUSE TestAccSecretsManagerSecretVersionDataSource_binary
=== RUN   TestAccSecretsManagerSecretVersionDataSource_versionID
=== PAUSE TestAccSecretsManagerSecretVersionDataSource_versionID
=== RUN   TestAccSecretsManagerSecretVersionDataSource_versionStage
=== PAUSE TestAccSecretsManagerSecretVersionDataSource_versionStage
=== CONT  TestAccSecretsManagerSecretVersionDataSource_basic
=== CONT  TestAccSecretsManagerSecretVersionDataSource_versionID
=== CONT  TestAccSecretsManagerSecretVersionDataSource_binary
=== CONT  TestAccSecretsManagerSecretVersionDataSource_versionStage
--- PASS: TestAccSecretsManagerSecretVersionDataSource_versionStage (14.90s)
--- PASS: TestAccSecretsManagerSecretVersionDataSource_binary (14.91s)
--- PASS: TestAccSecretsManagerSecretVersionDataSource_versionID (14.93s)
--- PASS: TestAccSecretsManagerSecretVersionDataSource_basic (15.16s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/secretsmanager	15.246s

Base64 encode the returned binary secret. This is consistant with how the
binary secret is supplied to the resource and with how the resource itself
represents the binary data. Simply casting the binary data to a string doesn't
appear to result in anything usable.
@github-actions github-actions bot added size/S Managed by automation to categorize the size of a PR. documentation Introduces or discusses updates to documentation. service/secretsmanager Issues and PRs that pertain to the secretsmanager service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. needs-triage Waiting for first response or review from a maintainer. labels Jul 10, 2022
@justinretzolk justinretzolk added bug Addresses a defect in current functionality. and removed needs-triage Waiting for first response or review from a maintainer. labels Jul 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Addresses a defect in current functionality. documentation Introduces or discusses updates to documentation. service/secretsmanager Issues and PRs that pertain to the secretsmanager service. size/S Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Datasource aws_secretsmanager_secret_version corrupts binary data
2 participants