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 support for organizations and organizational units for EC2 image builder distribution configuration #22104

Conversation

lvthillo
Copy link
Contributor

@lvthillo lvthillo commented Dec 8, 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 #21929

Output from acceptance testing:

$ make testacc TESTS=TestAccImageBuilderDistributionConfiguration_DistributionAMIDistribution PKG=imagebuilder
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/imagebuilder/... -v -count 1 -parallel 20 -run='TestAccImageBuilderDistributionConfiguration_DistributionAMIDistribution' -timeout 180m
=== RUN   TestAccImageBuilderDistributionConfiguration_DistributionAMIDistribution_amiTags
=== PAUSE TestAccImageBuilderDistributionConfiguration_DistributionAMIDistribution_amiTags
=== RUN   TestAccImageBuilderDistributionConfiguration_DistributionAMIDistribution_description
=== PAUSE TestAccImageBuilderDistributionConfiguration_DistributionAMIDistribution_description
=== RUN   TestAccImageBuilderDistributionConfiguration_DistributionAMIDistribution_kmsKeyID
=== PAUSE TestAccImageBuilderDistributionConfiguration_DistributionAMIDistribution_kmsKeyID
=== RUN   TestAccImageBuilderDistributionConfiguration_DistributionAMIDistributionLaunchPermission_userGroups
=== PAUSE TestAccImageBuilderDistributionConfiguration_DistributionAMIDistributionLaunchPermission_userGroups
=== RUN   TestAccImageBuilderDistributionConfiguration_DistributionAMIDistributionLaunchPermission_userIDs
=== PAUSE TestAccImageBuilderDistributionConfiguration_DistributionAMIDistributionLaunchPermission_userIDs
=== RUN   TestAccImageBuilderDistributionConfiguration_DistributionAMIDistributionLaunchPermission_organizationArns
--- PASS: TestAccImageBuilderDistributionConfiguration_DistributionAMIDistributionLaunchPermission_organizationArns (28.94s)
=== RUN   TestAccImageBuilderDistributionConfiguration_DistributionAMIDistributionLaunchPermission_organizationalUnitArns
--- PASS: TestAccImageBuilderDistributionConfiguration_DistributionAMIDistributionLaunchPermission_organizationalUnitArns (32.56s)
=== RUN   TestAccImageBuilderDistributionConfiguration_DistributionAMIDistribution_name
=== PAUSE TestAccImageBuilderDistributionConfiguration_DistributionAMIDistribution_name
=== RUN   TestAccImageBuilderDistributionConfiguration_DistributionAMIDistribution_targetAccountIDs
=== PAUSE TestAccImageBuilderDistributionConfiguration_DistributionAMIDistribution_targetAccountIDs
=== CONT  TestAccImageBuilderDistributionConfiguration_DistributionAMIDistribution_amiTags
=== CONT  TestAccImageBuilderDistributionConfiguration_DistributionAMIDistribution_name
=== CONT  TestAccImageBuilderDistributionConfiguration_DistributionAMIDistributionLaunchPermission_userGroups
=== CONT  TestAccImageBuilderDistributionConfiguration_DistributionAMIDistribution_kmsKeyID
=== CONT  TestAccImageBuilderDistributionConfiguration_DistributionAMIDistribution_targetAccountIDs
=== CONT  TestAccImageBuilderDistributionConfiguration_DistributionAMIDistributionLaunchPermission_userIDs
=== CONT  TestAccImageBuilderDistributionConfiguration_DistributionAMIDistribution_description
--- PASS: TestAccImageBuilderDistributionConfiguration_DistributionAMIDistributionLaunchPermission_userGroups (27.73s)
--- PASS: TestAccImageBuilderDistributionConfiguration_DistributionAMIDistributionLaunchPermission_userIDs (45.55s)
--- PASS: TestAccImageBuilderDistributionConfiguration_DistributionAMIDistribution_name (45.58s)
--- PASS: TestAccImageBuilderDistributionConfiguration_DistributionAMIDistribution_amiTags (45.64s)
--- PASS: TestAccImageBuilderDistributionConfiguration_DistributionAMIDistribution_targetAccountIDs (45.72s)
--- PASS: TestAccImageBuilderDistributionConfiguration_DistributionAMIDistribution_description (45.87s)
--- PASS: TestAccImageBuilderDistributionConfiguration_DistributionAMIDistribution_kmsKeyID (46.70s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/imagebuilder       110.438s

...

Example usage:

resource "aws_imagebuilder_distribution_configuration" "example" {
  name = "example"

  distribution {
    ami_distribution_configuration {
      ami_tags = {
        CostCenter = "IT"
      }

      name = "example-{{ imagebuilder:buildDate }}"

      launch_permission {
        organization_arns = ["arn:aws:organizations::111111111111:organization/o-aze123rty456"]
      }
    }

    region = "eu-west-1"
  }
}

@github-actions github-actions bot added size/L Managed by automation to categorize the size of a PR. service/imagebuilder Issues and PRs that pertain to the imagebuilder service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. needs-triage Waiting for first response or review from a maintainer. labels Dec 8, 2021
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Welcome @lvthillo 👋

It looks like this is your first Pull Request submission to the Terraform AWS Provider! If you haven’t already done so please make sure you have checked out our CONTRIBUTING guide and FAQ to make sure your contribution is adhering to best practice and has all the necessary elements in place for a successful approval.

Also take a look at our FAQ which details how we prioritize Pull Requests for inclusion.

Thanks again, and welcome to the community! 😃

@sethbacon
Copy link

Would love to see this make a release soon!

@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 Dec 9, 2021
@tolidano
Copy link

Keeping this alive - would like to see this merged ASAP - support for organizations is critical for our use case.

@sabrinaz-orion
Copy link

This would be really good to have!

@viebrock
Copy link

+1

1 similar comment
@drew3251
Copy link

+1

@tmseesz
Copy link

tmseesz commented Feb 17, 2022

would love to see this

@bassjompi
Copy link

+1 organization support

Copy link
Collaborator

@kamilturek kamilturek left a comment

Choose a reason for hiding this comment

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

I believe we need to update the documentation and provide a changelog. Besides that, looks good! Let me know if you need any help with it.

@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. labels Mar 22, 2022
@github-actions
Copy link

Thank you for your contribution! 🚀

Please note that the CHANGELOG.md file contents are handled by the maintainers during merge. This is to prevent pull request merge conflicts, especially for contributions which may not be merged immediately. Please see the Contributing Guide for additional pull request review items.

Remove any changes to the CHANGELOG.md file and commit them in this pull request to prevent delays with reviewing and potentially merging this pull request.

@lvthillo
Copy link
Contributor Author

lvthillo commented Mar 22, 2022

I believe we need to update the documentation and provide a changelog. Besides that, looks good! Let me know if you need any help with it.

I added the changelog entry but got some automated reply that I should remove it. Should I?

@github-actions github-actions bot removed the provider Pertains to the provider itself, rather than any interaction with AWS. label Mar 23, 2022
…ense configuration: ResourceLimitExceededException: You have reached the maximum allowed number of license configurations created in one day.'.
…tion: AccessDeniedException: Service role not found. Consult setup procedures in License Manager User Guide and create the required role for the service.'.
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 TESTS=TestAccImageBuilderDistributionConfigurationDataSource_ PKG=imagebuilder ACCTEST_PARALLELISM=2
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/imagebuilder/... -v -count 1 -parallel 2 -run='TestAccImageBuilderDistributionConfigurationDataSource_'  -timeout 180m
=== RUN   TestAccImageBuilderDistributionConfigurationDataSource_arn
=== PAUSE TestAccImageBuilderDistributionConfigurationDataSource_arn
=== CONT  TestAccImageBuilderDistributionConfigurationDataSource_arn
--- PASS: TestAccImageBuilderDistributionConfigurationDataSource_arn (20.25s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/imagebuilder	23.885s
% make testacc TESTS=TestAccImageBuilderDistributionConfiguration_ PKG=imagebuilder ACCTEST_PARALLELISM=2
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/imagebuilder/... -v -count 1 -parallel 2 -run='TestAccImageBuilderDistributionConfiguration_'  -timeout 180m
=== RUN   TestAccImageBuilderDistributionConfiguration_basic
=== PAUSE TestAccImageBuilderDistributionConfiguration_basic
=== RUN   TestAccImageBuilderDistributionConfiguration_disappears
=== PAUSE TestAccImageBuilderDistributionConfiguration_disappears
=== RUN   TestAccImageBuilderDistributionConfiguration_description
=== PAUSE TestAccImageBuilderDistributionConfiguration_description
=== RUN   TestAccImageBuilderDistributionConfiguration_distribution
=== PAUSE TestAccImageBuilderDistributionConfiguration_distribution
=== RUN   TestAccImageBuilderDistributionConfiguration_DistributionAMIDistribution_amiTags
=== PAUSE TestAccImageBuilderDistributionConfiguration_DistributionAMIDistribution_amiTags
=== RUN   TestAccImageBuilderDistributionConfiguration_DistributionAMIDistribution_description
=== PAUSE TestAccImageBuilderDistributionConfiguration_DistributionAMIDistribution_description
=== RUN   TestAccImageBuilderDistributionConfiguration_DistributionAMIDistribution_kmsKeyID
=== PAUSE TestAccImageBuilderDistributionConfiguration_DistributionAMIDistribution_kmsKeyID
=== RUN   TestAccImageBuilderDistributionConfiguration_DistributionAMIDistributionLaunchPermission_userGroups
=== PAUSE TestAccImageBuilderDistributionConfiguration_DistributionAMIDistributionLaunchPermission_userGroups
=== RUN   TestAccImageBuilderDistributionConfiguration_DistributionAMIDistributionLaunchPermission_userIDs
=== PAUSE TestAccImageBuilderDistributionConfiguration_DistributionAMIDistributionLaunchPermission_userIDs
=== RUN   TestAccImageBuilderDistributionConfiguration_DistributionAMIDistributionLaunchPermission_organizationArns
--- PASS: TestAccImageBuilderDistributionConfiguration_DistributionAMIDistributionLaunchPermission_organizationArns (21.91s)
=== RUN   TestAccImageBuilderDistributionConfiguration_DistributionAMIDistributionLaunchPermission_organizationalUnitArns
--- PASS: TestAccImageBuilderDistributionConfiguration_DistributionAMIDistributionLaunchPermission_organizationalUnitArns (21.93s)
=== RUN   TestAccImageBuilderDistributionConfiguration_DistributionAMIDistribution_name
=== PAUSE TestAccImageBuilderDistributionConfiguration_DistributionAMIDistribution_name
=== RUN   TestAccImageBuilderDistributionConfiguration_DistributionAMIDistribution_targetAccountIDs
=== PAUSE TestAccImageBuilderDistributionConfiguration_DistributionAMIDistribution_targetAccountIDs
=== RUN   TestAccImageBuilderDistributionConfiguration_DistributionContainerDistribution_containerTags
=== PAUSE TestAccImageBuilderDistributionConfiguration_DistributionContainerDistribution_containerTags
=== RUN   TestAccImageBuilderDistributionConfiguration_DistributionContainerDistribution_description
=== PAUSE TestAccImageBuilderDistributionConfiguration_DistributionContainerDistribution_description
=== RUN   TestAccImageBuilderDistributionConfiguration_DistributionContainerDistribution_targetRepository
=== PAUSE TestAccImageBuilderDistributionConfiguration_DistributionContainerDistribution_targetRepository
=== RUN   TestAccImageBuilderDistributionConfiguration_Distribution_launchTemplateConfiguration
=== PAUSE TestAccImageBuilderDistributionConfiguration_Distribution_launchTemplateConfiguration
=== RUN   TestAccImageBuilderDistributionConfiguration_Distribution_licenseARNs
=== PAUSE TestAccImageBuilderDistributionConfiguration_Distribution_licenseARNs
=== RUN   TestAccImageBuilderDistributionConfiguration_tags
=== PAUSE TestAccImageBuilderDistributionConfiguration_tags
=== CONT  TestAccImageBuilderDistributionConfiguration_basic
=== CONT  TestAccImageBuilderDistributionConfiguration_DistributionAMIDistribution_name
--- PASS: TestAccImageBuilderDistributionConfiguration_basic (17.67s)
=== CONT  TestAccImageBuilderDistributionConfiguration_DistributionContainerDistribution_targetRepository
--- PASS: TestAccImageBuilderDistributionConfiguration_DistributionAMIDistribution_name (29.77s)
=== CONT  TestAccImageBuilderDistributionConfiguration_tags
--- PASS: TestAccImageBuilderDistributionConfiguration_DistributionContainerDistribution_targetRepository (29.04s)
=== CONT  TestAccImageBuilderDistributionConfiguration_Distribution_licenseARNs
    acctest.go:788: skipping tests; missing IAM service-linked role /aws-service-role/license-manager.amazonaws.com. Please create the role and retry
--- SKIP: TestAccImageBuilderDistributionConfiguration_Distribution_licenseARNs (0.20s)
=== CONT  TestAccImageBuilderDistributionConfiguration_Distribution_launchTemplateConfiguration
--- PASS: TestAccImageBuilderDistributionConfiguration_tags (40.87s)
=== CONT  TestAccImageBuilderDistributionConfiguration_DistributionAMIDistribution_description
--- PASS: TestAccImageBuilderDistributionConfiguration_Distribution_launchTemplateConfiguration (31.10s)
=== CONT  TestAccImageBuilderDistributionConfiguration_DistributionAMIDistributionLaunchPermission_userIDs
--- PASS: TestAccImageBuilderDistributionConfiguration_DistributionAMIDistribution_description (29.16s)
=== CONT  TestAccImageBuilderDistributionConfiguration_DistributionAMIDistributionLaunchPermission_userGroups
--- PASS: TestAccImageBuilderDistributionConfiguration_DistributionAMIDistributionLaunchPermission_userIDs (28.99s)
=== CONT  TestAccImageBuilderDistributionConfiguration_DistributionAMIDistribution_kmsKeyID
--- PASS: TestAccImageBuilderDistributionConfiguration_DistributionAMIDistributionLaunchPermission_userGroups (17.73s)
=== CONT  TestAccImageBuilderDistributionConfiguration_DistributionContainerDistribution_containerTags
--- PASS: TestAccImageBuilderDistributionConfiguration_DistributionAMIDistribution_kmsKeyID (32.80s)
=== CONT  TestAccImageBuilderDistributionConfiguration_DistributionAMIDistribution_targetAccountIDs
--- PASS: TestAccImageBuilderDistributionConfiguration_DistributionContainerDistribution_containerTags (29.76s)
=== CONT  TestAccImageBuilderDistributionConfiguration_DistributionContainerDistribution_description
--- PASS: TestAccImageBuilderDistributionConfiguration_DistributionAMIDistribution_targetAccountIDs (29.54s)
=== CONT  TestAccImageBuilderDistributionConfiguration_DistributionAMIDistribution_amiTags
--- PASS: TestAccImageBuilderDistributionConfiguration_DistributionContainerDistribution_description (29.45s)
=== CONT  TestAccImageBuilderDistributionConfiguration_description
--- PASS: TestAccImageBuilderDistributionConfiguration_DistributionAMIDistribution_amiTags (32.50s)
=== CONT  TestAccImageBuilderDistributionConfiguration_distribution
--- PASS: TestAccImageBuilderDistributionConfiguration_description (30.73s)
=== CONT  TestAccImageBuilderDistributionConfiguration_disappears
--- PASS: TestAccImageBuilderDistributionConfiguration_disappears (13.02s)
--- PASS: TestAccImageBuilderDistributionConfiguration_distribution (20.25s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/imagebuilder	269.422s

@ewbankkit
Copy link
Contributor

@lvthillo Thanks for the contribution 🎉 👏.

@ewbankkit ewbankkit merged commit 7fc82c0 into hashicorp:main Mar 23, 2022
@tiendungitd
Copy link

I found issue #21929 released share AMI to organization, but have to use awscc provider
Does it the same with this pull request? I just want to ensure that this function also available in AWS provider.

@lvthillo lvthillo deleted the ec2-image-builder-distribution-org-ou-support branch March 25, 2022 08:10
@github-actions
Copy link

github-actions bot commented May 5, 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 May 5, 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. enhancement Requests to existing resources that expand the functionality or scope. service/imagebuilder Issues and PRs that pertain to the imagebuilder service. 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_imagebuilder_distribution_configuration: Add support for sharing AMIs with Organizations and OUs