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

Enable organization tag policies with attachment #11612

Conversation

ericksoen
Copy link
Contributor

@ericksoen ericksoen commented Jan 15, 2020

Overview

This PR enables the TAG_POLICY as a permitted aws_organizations_policy type and refactors the aws_organizations_policy_attachment to permit attaching policies of type TAG_POLICY

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 #11032
Relates #11202

Release note for CHANGELOG:

resource/aws_organizations_policy: Support `TAG_POLICY` type [GH-11032]
resource/aws_organizations_policy_attachment: Support `TAG_POLICY` type [GH-11032]

Output from acceptance testing:

make testacc TEST=./aws TESTARGS='-run=TestAccAWSOrganizations'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSOrganizations -timeout 120m
go: downloading github.com/aws/aws-sdk-go v1.28.8
go: downloading github.com/hashicorp/terraform-plugin-sdk v1.5.0
go: extracting github.com/hashicorp/terraform-plugin-sdk v1.5.0
go: extracting github.com/aws/aws-sdk-go v1.28.8
go: finding github.com/aws/aws-sdk-go v1.28.8
go: finding github.com/hashicorp/terraform-plugin-sdk v1.5.0
=== RUN   TestAccAWSOrganizations
=== RUN   TestAccAWSOrganizations/Organization
=== RUN   TestAccAWSOrganizations/Organization/EnabledPolicyTypes
=== RUN   TestAccAWSOrganizations/Organization/FeatureSet
=== RUN   TestAccAWSOrganizations/Organization/DataSource
=== RUN   TestAccAWSOrganizations/Organization/basic
=== RUN   TestAccAWSOrganizations/Organization/AwsServiceAccessPrincipals
=== RUN   TestAccAWSOrganizations/Account
=== RUN   TestAccAWSOrganizations/Account/basic
=== RUN   TestAccAWSOrganizations/Account/ParentId
=== RUN   TestAccAWSOrganizations/Account/Tags
=== RUN   TestAccAWSOrganizations/OrganizationalUnit
=== RUN   TestAccAWSOrganizations/OrganizationalUnit/basic
=== RUN   TestAccAWSOrganizations/OrganizationalUnit/Name
=== RUN   TestAccAWSOrganizations/OrganizationalUnits
=== RUN   TestAccAWSOrganizations/OrganizationalUnits/DataSource
=== PAUSE TestAccAWSOrganizations/OrganizationalUnits/DataSource
=== CONT  TestAccAWSOrganizations/OrganizationalUnits/DataSource
=== RUN   TestAccAWSOrganizations/Policy
=== RUN   TestAccAWSOrganizations/Policy/basic
=== RUN   TestAccAWSOrganizations/Policy/concurrent
=== RUN   TestAccAWSOrganizations/Policy/Description
=== RUN   TestAccAWSOrganizations/Policy/Type
=== RUN   TestAccAWSOrganizations/PolicyAttachment
=== RUN   TestAccAWSOrganizations/PolicyAttachment/Account
=== RUN   TestAccAWSOrganizations/PolicyAttachment/OrganizationalUnit
=== RUN   TestAccAWSOrganizations/PolicyAttachment/Root
--- PASS: TestAccAWSOrganizations (676.62s)
    --- PASS: TestAccAWSOrganizations/Organization (280.69s)
        --- PASS: TestAccAWSOrganizations/Organization/EnabledPolicyTypes (115.62s)
        --- PASS: TestAccAWSOrganizations/Organization/FeatureSet (24.66s)
        --- PASS: TestAccAWSOrganizations/Organization/DataSource (52.64s)
        --- PASS: TestAccAWSOrganizations/Organization/basic (26.63s)
        --- PASS: TestAccAWSOrganizations/Organization/AwsServiceAccessPrincipals (61.14s)
    --- PASS: TestAccAWSOrganizations/Account (0.00s)
        --- SKIP: TestAccAWSOrganizations/Account/basic (0.00s)
            resource_aws_organizations_account_test.go:15: AWS Organizations Account testing is not currently automated due to manual account deletion steps.
        --- SKIP: TestAccAWSOrganizations/Account/ParentId (0.00s)
            resource_aws_organizations_account_test.go:58: AWS Organizations Account testing is not currently automated due to manual account deletion steps.
        --- SKIP: TestAccAWSOrganizations/Account/Tags (0.00s)
            resource_aws_organizations_account_test.go:104: AWS Organizations Account testing is not currently automated due to manual account deletion steps.
    --- PASS: TestAccAWSOrganizations/OrganizationalUnit (73.84s)
        --- PASS: TestAccAWSOrganizations/OrganizationalUnit/basic (28.90s)
        --- PASS: TestAccAWSOrganizations/OrganizationalUnit/Name (44.94s)
    --- PASS: TestAccAWSOrganizations/OrganizationalUnits (0.00s)
        --- PASS: TestAccAWSOrganizations/OrganizationalUnits/DataSource (30.47s)
    --- PASS: TestAccAWSOrganizations/Policy (174.62s)
        --- PASS: TestAccAWSOrganizations/Policy/basic (43.08s)
        --- PASS: TestAccAWSOrganizations/Policy/concurrent (29.37s)
        --- PASS: TestAccAWSOrganizations/Policy/Description (43.36s)
        --- PASS: TestAccAWSOrganizations/Policy/Type (58.80s)
    --- PASS: TestAccAWSOrganizations/PolicyAttachment (116.99s)
        --- PASS: TestAccAWSOrganizations/PolicyAttachment/Account (51.02s)
        --- PASS: TestAccAWSOrganizations/PolicyAttachment/OrganizationalUnit (33.44s)
        --- PASS: TestAccAWSOrganizations/PolicyAttachment/Root (32.53s)
PASS
ok      github.com/terraform-providers/terraform-provider-aws/aws       677.120s

@ericksoen ericksoen requested a review from a team January 15, 2020 16:40
@ghost ghost added needs-triage Waiting for first response or review from a maintainer. size/M Managed by automation to categorize the size of a PR. service/organizations Issues and PRs that pertain to the organizations service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. documentation Introduces or discusses updates to documentation. labels Jan 15, 2020
@ericksoen ericksoen force-pushed the enable-organization-tag-policy-with-attachment branch from 584a2e7 to 8facd71 Compare January 25, 2020 06:59
@ericksoen ericksoen changed the title [WIP] Enable organization tag policies with attachment Enable organization tag policies with attachment Jan 27, 2020
@bflad bflad 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 Feb 6, 2020
@bflad bflad self-assigned this Feb 6, 2020
@bflad bflad added this to the v2.48.0 milestone Feb 6, 2020
Copy link
Contributor

@bflad bflad left a comment

Choose a reason for hiding this comment

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

This looks good, thanks so much, @ericksoen 🚀 Will add a note in the CHANGELOG that the underlying call to the aws_organizations_policy_attachment resource has switched in case folks have restrictive IAM policies.

Output from acceptance testing:

    --- PASS: TestAccAWSOrganizations/Policy (138.40s)
        --- PASS: TestAccAWSOrganizations/Policy/basic (32.06s)
        --- PASS: TestAccAWSOrganizations/Policy/concurrent (32.60s)
        --- PASS: TestAccAWSOrganizations/Policy/Description (29.99s)
        --- PASS: TestAccAWSOrganizations/Policy/Type (43.75s)
    --- PASS: TestAccAWSOrganizations/PolicyAttachment (94.82s)
        --- PASS: TestAccAWSOrganizations/PolicyAttachment/Account (40.77s)
        --- PASS: TestAccAWSOrganizations/PolicyAttachment/OrganizationalUnit (27.87s)
        --- PASS: TestAccAWSOrganizations/PolicyAttachment/Root (26.17s)

@bflad bflad merged commit 3c0deb7 into hashicorp:master Feb 6, 2020
bflad added a commit that referenced this pull request Feb 6, 2020
@ericksoen ericksoen deleted the enable-organization-tag-policy-with-attachment branch February 6, 2020 03:16
@ghost
Copy link

ghost commented Feb 7, 2020

This has been released in version 2.48.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 for triage. Thanks!

@ghost
Copy link

ghost commented Mar 27, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked and limited conversation to collaborators Mar 27, 2020
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/organizations Issues and PRs that pertain to the organizations service. size/M 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.

Add Tag Policies to Organizations Support
2 participants