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

feat: Add insecure_value to datasource aws_ssm_parameter #30817

Merged

Conversation

Jno21
Copy link
Contributor

@Jno21 Jno21 commented Apr 19, 2023

Description

Add insecure_value to datasource aws_ssm_parameter. The idea is to have the possibility to expose the value as insecure like in the resource aws_ssm_parameter.

Relations

Closes #26915

References

Output from Acceptance Testing

$ make testacc TESTS=TestAccSSMParameterDataSource_basic PKG=ssm
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/ssm/... -v -count 1 -parallel 20 -run='TestAccSSMParameterDataSource_basic'  -timeout 180m
=== RUN   TestAccSSMParameterDataSource_basic
=== PAUSE TestAccSSMParameterDataSource_basic
=== CONT  TestAccSSMParameterDataSource_basic
--- PASS: TestAccSSMParameterDataSource_basic (107.81s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/ssm        122.663s
$ make testacc TESTS=TestAccSSMParameterDataSource_fullPath PKG=ssm
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/ssm/... -v -count 1 -parallel 20 -run='TestAccSSMParameterDataSource_fullPath'  -timeout 180m
=== RUN   TestAccSSMParameterDataSource_fullPath
=== PAUSE TestAccSSMParameterDataSource_fullPath
=== CONT  TestAccSSMParameterDataSource_fullPath
--- PASS: TestAccSSMParameterDataSource_fullPath (120.89s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/ssm        137.380s

@github-actions
Copy link

Community Note

Voting for Prioritization

  • Please vote on this pull request by adding a 👍 reaction to the original post to help the community and maintainers prioritize this pull request.
  • Please see our prioritization guide for information on how we prioritize.
  • 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.

For Submitters

  • Review the contribution guide relating to the type of change you are making to ensure all of the necessary steps have been taken.
  • For new resources and data sources, use skaff to generate scaffolding with comments detailing common expectations.
  • Whether or not the branch has been rebased will not impact prioritization, but doing so is always a welcome surprise.

@github-actions github-actions bot added documentation Introduces or discusses updates to documentation. service/ssm Issues and PRs that pertain to the ssm service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. size/XS Managed by automation to categorize the size of a PR. needs-triage Waiting for first response or review from a maintainer. and removed documentation Introduces or discusses updates to documentation. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. service/ssm Issues and PRs that pertain to the ssm service. labels Apr 19, 2023
@github-actions github-actions bot added documentation Introduces or discusses updates to documentation. service/ssm Issues and PRs that pertain to the ssm service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. labels Apr 19, 2023
@Jno21 Jno21 marked this pull request as ready for review April 19, 2023 12:50
@Jno21 Jno21 changed the title feat: Add insecure_value to datasource aws_ssm_parameter feat: Add insecure_value to datasource aws_ssm_parameter Apr 19, 2023
@justinretzolk justinretzolk added enhancement Requests to existing resources that expand the functionality or scope. and removed needs-triage Waiting for first response or review from a maintainer. labels Apr 19, 2023
@agupta94
Copy link

agupta94 commented May 4, 2023

@Jno21 ThankYou for this PR!
Would it be easier to add nonsensitive = true that would flag value to be nonsensitive?
That would prevent us from switching all references of value to insecure_value, otherwise this is no different than simply doing nonsensitive(data.aws_ssm_parameter.xyz.value) currently.

@Jno21
Copy link
Contributor Author

Jno21 commented May 12, 2023

@agupta94 Thank you for your comment.

Would it be easier to add nonsensitive = true that would flag value to be nonsensitive? That would prevent us from switching all references of value to insecure_value, otherwise this is no different than simply doing nonsensitive(data.aws_ssm_parameter.xyz.value) currently.

That would be an idea, my first though was to have the value exposed as sensitive or not depending on the SecureString or String in ssm parameter. Unfortunately the way I understand the Terraform SDK it is not possible to change dynamically the value of a sensitive value since it is set in the Schema before any interaction, if I am wrong on this I will be happy to know how to do it.
I also think that the vision of the aws provider is to avoid implicit behaviors, having a behavior that change the way a value work depending on something else is quite risky and can induce error.

Globally I follow what was done here: #25721 to have the same behavior on the resource and data.

To answer the last part, yes indeed doing nonsensitive would be the same, but that would also mean using locals if you want to use that value multiples time, I think the insecure_value make it easier code wise.

If there is a better solution possible, that I didn't think of and it respect the way this provider wants to go, I would be totally down to work on it :)

@github-actions github-actions bot added size/S Managed by automation to categorize the size of a PR. and removed size/XS Managed by automation to categorize the size of a PR. labels Jul 10, 2023
@nam054 nam054 force-pushed the f-data_aws_ssm_parameter-insecure_value-26915 branch from 42ffaa9 to df071f8 Compare July 10, 2023 17:04
@nam054
Copy link
Contributor

nam054 commented Jul 10, 2023

🚀 LGTM! Thank you for your contribution!!

==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/ssm/... -v -count 1 -parallel 20  -run=TestAccSSMParameterDataSource_ -timeout 180m
=== RUN   TestAccSSMParameterDataSource_basic
=== PAUSE TestAccSSMParameterDataSource_basic
=== RUN   TestAccSSMParameterDataSource_fullPath
=== PAUSE TestAccSSMParameterDataSource_fullPath
=== RUN   TestAccSSMParameterDataSource_insecureValue
=== PAUSE TestAccSSMParameterDataSource_insecureValue
=== CONT  TestAccSSMParameterDataSource_basic
=== CONT  TestAccSSMParameterDataSource_insecureValue
=== CONT  TestAccSSMParameterDataSource_fullPath
--- PASS: TestAccSSMParameterDataSource_fullPath (16.82s)
--- PASS: TestAccSSMParameterDataSource_insecureValue (17.02s)
--- PASS: TestAccSSMParameterDataSource_basic (28.23s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/ssm        31.573s

@nam054 nam054 merged commit 3805281 into hashicorp:main Jul 10, 2023
47 checks passed
@github-actions github-actions bot added this to the v5.8.0 milestone Jul 10, 2023
@github-actions
Copy link

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

@github-actions
Copy link

I'm going to lock this pull request 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 related to this change, 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 Aug 13, 2023
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. enhancement Requests to existing resources that expand the functionality or scope. service/ssm Issues and PRs that pertain to the ssm 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.

[Bug]: data.aws_ssm_parameter - Non SecureString SSM parameters marked as sensitive
4 participants