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

Add aws_workspaces_directory.saml_properties #39060

Merged

Conversation

ablackrw
Copy link
Contributor

Description

Adds the saml_properties structure within the aws_workspaces_directory resource and datasource to allow Terraform management of the SAML 2.0 integration in AWS Workspaces.

Relations

Closes #29359

References

Setting up SAML 2.0

Output from Acceptance Testing

% make testacc TESTS=TestAccWorkSpacesDataSource_serial/Directory PKG=workspaces 
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.22.5 test ./internal/service/workspaces/... -v -count 1 -parallel 20 -run='TestAccWorkSpacesDataSource_serial/Directory'  -timeout 360m
=== RUN   TestAccWorkSpacesDataSource_serial
=== PAUSE TestAccWorkSpacesDataSource_serial
=== CONT  TestAccWorkSpacesDataSource_serial
=== RUN   TestAccWorkSpacesDataSource_serial/Directory
=== RUN   TestAccWorkSpacesDataSource_serial/Directory/basic
--- PASS: TestAccWorkSpacesDataSource_serial (683.86s)
    --- PASS: TestAccWorkSpacesDataSource_serial/Directory (683.86s)
        --- PASS: TestAccWorkSpacesDataSource_serial/Directory/basic (683.86s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/workspaces688.387s
% make testacc TESTS=TestAccWorkSpaces_serial/Directory/basic PKG=workspaces
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.22.5 test ./internal/service/workspaces/... -v -count 1 -parallel 20 -run='TestAccWorkSpaces_serial/Directory/basic'  -timeout 360m
=== RUN   TestAccWorkSpaces_serial
=== PAUSE TestAccWorkSpaces_serial
=== CONT  TestAccWorkSpaces_serial
=== RUN   TestAccWorkSpaces_serial/Directory
=== RUN   TestAccWorkSpaces_serial/Directory/basic
--- PASS: TestAccWorkSpaces_serial (744.87s)
    --- PASS: TestAccWorkSpaces_serial/Directory (744.87s)
        --- PASS: TestAccWorkSpaces_serial/Directory/basic (744.87s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/workspaces749.414s
% make testacc TESTS=TestAccWorkSpaces_serial/Directory/workspaceSamlProperties PKG=workspaces
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.22.5 test ./internal/service/workspaces/... -v -count 1 -parallel 20 -run='TestAccWorkSpaces_serial/Directory/workspaceSamlProperties'  -timeout 360m
=== RUN   TestAccWorkSpaces_serial
=== PAUSE TestAccWorkSpaces_serial
=== CONT  TestAccWorkSpaces_serial
=== RUN   TestAccWorkSpaces_serial/Directory
=== RUN   TestAccWorkSpaces_serial/Directory/workspaceSamlProperties
--- PASS: TestAccWorkSpaces_serial (779.96s)
    --- PASS: TestAccWorkSpaces_serial/Directory (779.96s)
        --- PASS: TestAccWorkSpaces_serial/Directory/workspaceSamlProperties (779.96s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/workspaces784.458s

* `directory.go` (`ResourceDirectory()`): Add `saml_properties` structure to schema.
  (`resourceDirectoryCreate()`): Call `ModifySamlProperties` if `saml_properties` structure is present.
  (`resourceDirectoryRead()`): Store `directory.SamlProperties` in `saml_properties` structure.
  (`resourceDirectoryUpdate()`): Call `ModifySamlProperties` if `saml_properties` structure has changed.
  (`ExpandSAMLProperties()`): Add expander for `types.SamlProperties`.
  (`FlattenSAMLProperties()`): Add flattener for `types.SamlProperties`.
  (`SamlStatusEnumValues()`): Add helper for listing `types.SamlStatusEnum` values.
* `directory_data_source.go` (`DataSourceDirectory()`): Add `saml_properties` structure to schema.
  (`dataSourceDirectoryRead()`): Store `directory.SamlProperties` in `saml_properties` structure.
* `directory_data_source_test.go` (`testAccDirectoryDataSource_basic()`): Validate `saml_properties` structure data matches resource object.
  `testAccDirectoryDataSourceConfig_basic()`: Add `saml_properties` structure to reference object.
* `directory_test.go` (`testAccDirectory_basic()`): Validate default values of `saml_properties` structure.
  (`testAccDirectory_SamlProperties()`): Validate `saml_properties` structure is correctly mutated.
  (`TestExpandSAMLProperties()`): Unit test expander.
  (`TestFlattenSAMLProperties()`): Unit test flattener.
  (`testAccDirectoryConfig_samlPropertiesFull()`): Helper to generate state for `testAccDirectory_SamlProperties()`.
  (`testAccDirectoryConfig_samlPropertiesRSPN()`): Helper to generate state for `testAccDirectory_SamlProperties()`.
  (`testAccDirectoryConfig_samlPropertiesUAU()`): Helper to generate state for `testAccDirectory_SamlProperties()`.
  (`testAccDirectoryConfig_samlPropertiesEmpty()`): Helper to generate state for `testAccDirectory_SamlProperties()`.
* `workspaces_test.go` (`TestAccWorkSpaces_serial()`): Add `testAccDirectory_SamlProperties` as subtest.
* `workspaces_directory.html.markdown`: Document new `saml_properties` structure.
@ablackrw ablackrw requested a review from a team as a code owner August 27, 2024 22:18
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/workspaces Issues and PRs that pertain to the workspaces service. needs-triage Waiting for first response or review from a maintainer. labels Aug 27, 2024
* `directory_data_source_test.go` (`testAccDirectoryDataSource_basic()`): Make `saml_properties` testing more robust.
  (`testAccDirectoryDataSourceConfig_basic()`): Remove use of hardcoded URI, replace with dynamic value.
@ablackrw
Copy link
Contributor Author

With the modification to directory_data_source_test.go, I've rerun the test, producing the following output

% make testacc TESTS=TestAccWorkSpacesDataSource_serial/Directory PKG=workspaces
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.23.0 test ./internal/service/workspaces/... -v -count 1 -parallel 20 -run='TestAccWorkSpacesDataSource_serial/Directory'  -timeout 360m
=== RUN   TestAccWorkSpacesDataSource_serial
=== PAUSE TestAccWorkSpacesDataSource_serial
=== CONT  TestAccWorkSpacesDataSource_serial
=== RUN   TestAccWorkSpacesDataSource_serial/Directory
=== RUN   TestAccWorkSpacesDataSource_serial/Directory/basic
--- PASS: TestAccWorkSpacesDataSource_serial (781.68s)
    --- PASS: TestAccWorkSpacesDataSource_serial/Directory (781.68s)
        --- PASS: TestAccWorkSpacesDataSource_serial/Directory/basic (781.68s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/workspaces786.621s

@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 Aug 28, 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 🚀.

% CCTEST_TIMEOUT=720m make testacc TESTARGS='-run=TestAccWorkSpaces_serial/^Directory$$/basic\|TestAccWorkSpacesDataSource_serial/^Directory$$/basic\|TestAccWorkSpacesDataSource_serial/^Directory$$/workspaceSamlProperties' PKG=workspaces
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.23.2 test ./internal/service/workspaces/... -v -count 1 -parallel 20  -run=TestAccWorkSpaces_serial/^Directory$/basic\|TestAccWorkSpacesDataSource_serial/^Directory$/basic\|TestAccWorkSpacesDataSource_serial/^Directory$/workspaceSamlProperties -timeout 360m
2024/10/15 13:14:56 Initializing Terraform AWS Provider...
=== RUN   TestAccWorkSpacesDataSource_serial
=== PAUSE TestAccWorkSpacesDataSource_serial
=== RUN   TestAccWorkSpaces_serial
=== PAUSE TestAccWorkSpaces_serial
=== CONT  TestAccWorkSpacesDataSource_serial
=== CONT  TestAccWorkSpaces_serial
=== RUN   TestAccWorkSpacesDataSource_serial/Directory
=== RUN   TestAccWorkSpaces_serial/Directory
=== RUN   TestAccWorkSpacesDataSource_serial/Directory/basic
=== RUN   TestAccWorkSpaces_serial/Directory/basic
--- PASS: TestAccWorkSpaces_serial (669.87s)
    --- PASS: TestAccWorkSpaces_serial/Directory (669.87s)
        --- PASS: TestAccWorkSpaces_serial/Directory/basic (669.87s)
--- PASS: TestAccWorkSpacesDataSource_serial (689.60s)
    --- PASS: TestAccWorkSpacesDataSource_serial/Directory (689.60s)
        --- PASS: TestAccWorkSpacesDataSource_serial/Directory/basic (689.60s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/workspaces	694.649s

@ewbankkit ewbankkit self-assigned this Oct 15, 2024
@github-actions github-actions bot added the prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. label Oct 15, 2024
@ewbankkit
Copy link
Contributor

@ablackrw Thanks for the contribution 🎉 👏.

@ewbankkit ewbankkit merged commit a9e1cd7 into hashicorp:main Oct 15, 2024
47 checks passed
@github-actions github-actions bot added this to the v5.72.0 milestone Oct 15, 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 15, 2024
Copy link

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

@ablackrw ablackrw deleted the f-aws_workspaces_directory-saml_properties branch October 24, 2024 13:02
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 Nov 24, 2024
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/workspaces Issues and PRs that pertain to the workspaces 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.

[Enhancement]: workspace saml integration
3 participants