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

d/aws_ssm_patch_baselines: new data source #39779

Merged
merged 1 commit into from
Oct 21, 2024
Merged

Conversation

jar-b
Copy link
Member

@jar-b jar-b commented Oct 17, 2024

Description

This data source will allow practitioners to list all AWS SSM patch baselines, with optional filters.

The forthcoming aws_ssmquicksetup_configuration_manager resource accepts a JSON string of selected patch baselines as part of the configuration for a patch policy, for which the output of this data source can be used. For example,

locals {
  # transform the output of the aws_ssm_patch_baselines data source
  # into the format expected by the SelectedPatchBaselines parameter
  selected_patch_baselines = jsonencode({
    for baseline in data.aws_ssm_patch_baselines.test.baseline_identities : baseline.operating_system => {
      "value" : baseline.baseline_id
      "label" : baseline.baseline_name
      "description" : baseline.baseline_description
      "disabled" : !baseline.default_baseline
    }
  })
}

Relations

Relates #29549

References

Output from Acceptance Testing

% make testacc PKG=ssm TESTS=TestAccSSMPatchBaselinesDataSource_
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.23.2 test ./internal/service/ssm/... -v -count 1 -parallel 20 -run='TestAccSSMPatchBaselinesDataSource_'  -timeout 360m
2024/10/17 14:31:44 Initializing Terraform AWS Provider...

--- PASS: TestAccSSMPatchBaselinesDataSource_filter (9.70s)
--- PASS: TestAccSSMPatchBaselinesDataSource_defaultBaselines (9.70s)
--- PASS: TestAccSSMPatchBaselinesDataSource_basic (9.70s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/ssm        15.980s

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. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. service/ssm Issues and PRs that pertain to the ssm service. generators Relates to code generators. prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. labels Oct 17, 2024
This data source will allow practitioners to list all AWS SSM patch baselines, with optional filters.

```console
% make testacc PKG=ssm TESTS=TestAccSSMPatchBaselinesDataSource_
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.23.2 test ./internal/service/ssm/... -v -count 1 -parallel 20 -run='TestAccSSMPatchBaselinesDataSource_'  -timeout 360m
2024/10/17 14:31:44 Initializing Terraform AWS Provider...

--- PASS: TestAccSSMPatchBaselinesDataSource_filter (9.70s)
--- PASS: TestAccSSMPatchBaselinesDataSource_defaultBaselines (9.70s)
--- PASS: TestAccSSMPatchBaselinesDataSource_basic (9.70s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/ssm        15.980s
```
@jar-b jar-b marked this pull request as ready for review October 17, 2024 19:33
@jar-b jar-b requested a review from a team as a code owner October 17, 2024 19:33
@jar-b jar-b added the new-data-source Introduces a new data source. label Oct 17, 2024
Copy link
Contributor

@ewbankkit ewbankkit left a comment

Choose a reason for hiding this comment

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

LGTM 🚀.

% make testacc TESTARGS='-run=TestAccSSMPatchBaselinesDataSource_' PKG=ssm
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.23.2 test ./internal/service/ssm/... -v -count 1 -parallel 20  -run=TestAccSSMPatchBaselinesDataSource_ -timeout 360m
2024/10/18 08:40:53 Initializing Terraform AWS Provider...
=== RUN   TestAccSSMPatchBaselinesDataSource_basic
=== PAUSE TestAccSSMPatchBaselinesDataSource_basic
=== RUN   TestAccSSMPatchBaselinesDataSource_defaultBaselines
=== PAUSE TestAccSSMPatchBaselinesDataSource_defaultBaselines
=== RUN   TestAccSSMPatchBaselinesDataSource_filter
=== PAUSE TestAccSSMPatchBaselinesDataSource_filter
=== CONT  TestAccSSMPatchBaselinesDataSource_basic
=== CONT  TestAccSSMPatchBaselinesDataSource_filter
=== CONT  TestAccSSMPatchBaselinesDataSource_defaultBaselines
--- PASS: TestAccSSMPatchBaselinesDataSource_defaultBaselines (9.05s)
--- PASS: TestAccSSMPatchBaselinesDataSource_basic (9.05s)
--- PASS: TestAccSSMPatchBaselinesDataSource_filter (9.07s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/ssm	14.291s

@jar-b jar-b merged commit 70c945e into main Oct 21, 2024
67 checks passed
@jar-b jar-b deleted the f-ssm_patch_baselines branch October 21, 2024 13:43
@github-actions github-actions bot added this to the v5.73.0 milestone Oct 21, 2024
@github-actions github-actions bot removed the prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. label Oct 24, 2024
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Introduces or discusses updates to documentation. generators Relates to code generators. new-data-source Introduces a new data source. service/ssm Issues and PRs that pertain to the ssm service. 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.

2 participants