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

#13605 added base64decode string before sending to aws-sdk-go, so cer… #17958

Merged
merged 2 commits into from
Mar 17, 2021

Conversation

sonikro
Copy link
Contributor

@sonikro sonikro commented Mar 5, 2021

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 #13605
Relates #15945
Relates #13826

When uploading Oracle Wallet files to aws_dms_certificate, we cant use the file function when reading the certificate file, because the certificate file contains invalid UTF-8 Characters. So we have to use filebase64 function to load the certificate.

Example:

resource "aws_dms_certificate" "oracle-wallet" {
  certificate_id     = "cute-certificate"
  certificate_wallet = filebase64("cwallet_${var.environment}.sso")
}

However, the aws-sdk-go, already encodes the bytearray to base64, when uploading the content to AWS. So if we don't decode the base64 string, before sending to the aws-sdk-go, the aws-sdk-go will encode the content's again, causing the certificate file to be corrupted.

…o, so certificate_wallet is not encoded twice
@sonikro sonikro requested a review from a team as a code owner March 5, 2021 18:19
@ghost ghost added size/XS Managed by automation to categorize the size of a PR. service/databasemigrationservice labels Mar 5, 2021
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Mar 5, 2021
@anGie44 anGie44 added the bug Addresses a defect in current functionality. label Mar 12, 2021
@anGie44 anGie44 self-assigned this Mar 15, 2021
@anGie44 anGie44 removed the needs-triage Waiting for first response or review from a maintainer. label Mar 15, 2021
Copy link
Contributor

@anGie44 anGie44 left a comment

Choose a reason for hiding this comment

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

Hi @sonikro , thank you for creating this PR! the resource change looks like what we need 👍 To get this into the upcoming release, I'm going to push up additional logic to handle encoding the value back on read, else a non-empty plan will result after applying a config with the certificate_wallet argument. In addition, i've taken the opportunity to refactor some bits since there still exists quite some legacy logic.

@ghost ghost added size/L Managed by automation to categorize the size of a PR. documentation Introduces or discusses updates to documentation. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. and removed size/XS Managed by automation to categorize the size of a PR. labels Mar 17, 2021
@anGie44 anGie44 added this to the v3.33.0 milestone Mar 17, 2021
Copy link
Contributor

@anGie44 anGie44 left a comment

Choose a reason for hiding this comment

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

Thanks again @sonikro 🚀
Output of acceptance tests (commercial):

--- PASS: TestAccAWSDmsCertificate_disappears (10.21s)
--- PASS: TestAccAWSDmsCertificate_CertificateWallet (13.87s)
--- PASS: TestAccAWSDmsCertificate_basic (13.89s)
--- PASS: TestAccAWSDmsCertificate_tags (31.37s)

@anGie44 anGie44 merged commit 16061dd into hashicorp:main Mar 17, 2021
@sonikro
Copy link
Contributor Author

sonikro commented Mar 17, 2021

Awesome @anGie44 ! Thanks for improving the code. This is my first time using Go Lang haha. Excited for the next release, so I can finally remove my "work around" code.

@ghost
Copy link

ghost commented Mar 18, 2021

This has been released in version 3.33.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 for triage. Thanks!

@ghost
Copy link

ghost commented Apr 16, 2021

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 as resolved and limited conversation to collaborators Apr 16, 2021
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. documentation Introduces or discusses updates to documentation. size/L 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.

aws_dms_certificate doesn't import Oracle wallet correctly
2 participants