Terraform-provider-aws: Add Tag Policies to Organizations Support

Created on 27 Nov 2019  ·  10Comments  ·  Source: hashicorp/terraform-provider-aws

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

Amazon announced support for Tag Policies to manage intra-organization tagging standards and support should be added for this construct.

New or Affected Resource(s)

  • aws_organizations_policy

Potential Terraform Configuration

resource "aws_organizations_policy" "tags_example" {
  name = "tags_example"
  type = ?? # Currently unknown
  content = <<CONTENT
{
    "tags": {
        "CostCenter": {
            "tag_key": {
                "@@assign": "CostCenter"
            },
            "tag_value": {
                "@@assign": [
                    "100",
                    "200"
                ]
            },
            "enforced_for": {
                "@@assign": [
                    "secretsmanager:*"
                ]
            }
        }
    }
}
CONTENT
}

References

  • https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_tag-policies.html

  • https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_example-tag-policies.html#tag-policy-example-key-case
  • enhancement servicorganizations

    Most helpful comment

    I'm happy to submit a PR for this soon. I have a work in progress branch, and I can already create/update/destroy tag policies. I want to verify that functionality is solid, and then I would just have to update the tests and documentation.

    All 10 comments

    I'm happy to submit a PR for this soon. I have a work in progress branch, and I can already create/update/destroy tag policies. I want to verify that functionality is solid, and then I would just have to update the tests and documentation.

    Related feature request to track aws_organizations_organization resource support for TAG_POLICY as valid enabled_policy_types value: #11202

    Hi,
    Any update on this ?
    We are looking forward to testing and using it soon :)

    testing out 2.46.0 and getting this error when changing the type to TAG_POLICY

    Error: expected type to be one of [SERVICE_CONTROL_POLICY], got TAG_POLICY

    @alangford There's a few different places the TAG_POLICY needs to be enabled to be fully functional. In v2.46.0, a change was merged to allow enabling it at the organization level, but did not include any changes to permit is as a TAG_POLICY type for the aws_organizations_policy resource. The PR for that change is referenced above #11612 (I've resolved the WIP items, but don't have any ETA on when it will be reviewed, merged, or released)

    Thank you @ericksoen I will close #11754 for being invalid

    Support for tag policies has been merged into the aws_organizations_policy and aws_organizations_policy_attachment resources, which will release with version 2.48.0 of the Terraform AWS Provider, tomorrow. Thanks to @ericksoen for the implementation. 👍

    Please note that if you use restrictive IAM policies for the Terraform execution, that the underlying API call for the aws_organizations_policy_attachment resource has switched from ListPoliciesForTarget to ListTargetsForPolicy.

    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!

    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!

    Was this page helpful?
    0 / 5 - 0 ratings