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

New resource for Appstream Directory Config #21505

Merged
merged 14 commits into from
Nov 16, 2021

Conversation

coderGo93
Copy link
Contributor

Added a new resource, doc and tests for AppStream Directory Config called aws_appstream_directory_config

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

Relates #6508

Output from acceptance testing:

$ make testacc TESTARGS='-run=TestAccAppStreamDirectoryConfig' PKG_NAME=internal/service/appstream
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/appstream/... -v -count 1 -parallel 20 -run=TestAccAppStreamDirectoryConfig -timeout 180m
=== RUN   TestAccAppStreamDirectoryConfig_basic
=== PAUSE TestAccAppStreamDirectoryConfig_basic
=== RUN   TestAccAppStreamDirectoryConfig_disappears
=== PAUSE TestAccAppStreamDirectoryConfig_disappears
=== CONT  TestAccAppStreamDirectoryConfig_basic
=== CONT  TestAccAppStreamDirectoryConfig_disappears
--- PASS: TestAccAppStreamDirectoryConfig_disappears (40.98s)
--- PASS: TestAccAppStreamDirectoryConfig_basic (64.27s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/appstream  64.308s

@github-actions github-actions bot added documentation Introduces or discusses updates to documentation. provider Pertains to the provider itself, rather than any interaction with AWS. service/appstream Issues and PRs that pertain to the appstream service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. size/XL Managed by automation to categorize the size of a PR. needs-triage Waiting for first response or review from a maintainer. labels Oct 26, 2021
@justinretzolk justinretzolk added new-resource Introduces a new resource. and removed needs-triage Waiting for first response or review from a maintainer. labels Oct 26, 2021
@gdavison gdavison mentioned this pull request Nov 8, 2021
8 tasks
@gdavison gdavison self-assigned this Nov 8, 2021
Copy link
Contributor

@gdavison gdavison left a comment

Choose a reason for hiding this comment

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

Hi @coderGo93, I wasn't able to run the acceptance tests. The tests need an ActiveDirectory directory to work with. I've also added some comments on the code

internal/service/appstream/directory_config_test.go Outdated Show resolved Hide resolved

resource "aws_appstream_directory_config" "test" {
directory_name = %[1]q
organizational_unit_distinguished_names = data.aws_organizations_organizational_units.test.children.*.id
Copy link
Contributor

Choose a reason for hiding this comment

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

The organizational unit referenced by this parameter is an Active Directory OU, and isn't related to AWS Organizations. You'll want to create an aws_directory_service_directory to test this with.

internal/service/appstream/directory_config.go Outdated Show resolved Hide resolved
internal/service/appstream/directory_config_test.go Outdated Show resolved Hide resolved
internal/service/appstream/directory_config.go Outdated Show resolved Hide resolved
Copy link
Contributor

@gdavison gdavison left a comment

Choose a reason for hiding this comment

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

Hi @coderGo93. I've made a few updates to the PR.

Acceptance test results in Commercial partition

--- PASS: TestAccAppStreamDirectoryConfig_disappears (1745.24s)
--- PASS: TestAccAppStreamFleet_completeWithStop (1779.84s)
--- PASS: TestAccAppStreamDirectoryConfig_OrganizationalUnitDistinguishedNames (1874.46s)
--- PASS: TestAccAppStreamDirectoryConfig_basic (3211.72s)

Acceptance test results in GovCloud partition

--- PASS: TestAccAppStreamDirectoryConfig_disappears (1525.85s)
--- PASS: TestAccAppStreamDirectoryConfig_OrganizationalUnitDistinguishedNames (1598.33s)
--- PASS: TestAccAppStreamDirectoryConfig_basic (3017.28s)

}

var output *appstream.CreateDirectoryConfigOutput
err := resource.RetryContext(ctx, directoryConfigTimeout, func() *resource.RetryError {
Copy link
Contributor

Choose a reason for hiding this comment

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

CreateDirectoryConfig is a synchronous operation, so we don't need the Retry

return diag.FromErr(fmt.Errorf("error creating Appstream DirectoryConfig (%s): %w", d.Id(), err))
}

d.SetId(aws.StringValue(output.DirectoryConfig.DirectoryName))
Copy link
Contributor

Choose a reason for hiding this comment

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

We need to make sure that neither output nor output.DirectoryConfig is nil to avoid panics


resource "aws_appstream_directory_config" "test" {
directory_name = %[1]q
organizational_unit_distinguished_names = [aws_directory_service_directory.test.id]
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be an Active Directory Organizational Unit Distinguished Name: https://docs.microsoft.com/en-us/previous-versions/windows/desktop/ldap/distinguished-names

},
})
}

Copy link
Contributor

Choose a reason for hiding this comment

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

There should be tests for multiple OUs and adding and removing OUs

@gdavison gdavison merged commit ea7095e into hashicorp:main Nov 16, 2021
@github-actions github-actions bot added this to the v3.66.0 milestone Nov 16, 2021
@github-actions
Copy link

This functionality has been released in v3.66.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

github-actions bot commented Jun 8, 2022

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 Jun 8, 2022
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. new-resource Introduces a new resource. provider Pertains to the provider itself, rather than any interaction with AWS. service/appstream Issues and PRs that pertain to the appstream service. size/XL 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.

None yet

3 participants