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

resource/aws_organizations_account: Add tags argument #9202

Merged
merged 2 commits into from
Jul 8, 2019

Conversation

bflad
Copy link
Member

@bflad bflad commented Jul 2, 2019

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" comments, they generate extra noise for pull request followers and do not help prioritize the request

Closes #8896

Release note for CHANGELOG:

* resource/aws_organizations_account: Add `tags` argument

AWS Organizations Account testing is manual due to the lack of an automated deletion APIs. Manually verified with locally updated Terraform AWS Provider binary.

Starting configuration:

resource "aws_organizations_account" "bflad-dev2" {
  name  = "bflad-dev2"
  email = "--OMITTED--"
}

Planned:

$ terraform plan
...
No changes. Infrastructure is up-to-date.

Updated configuration:

resource "aws_organizations_account" "bflad-dev2" {
  name  = "bflad-dev2"
  email = "--OMITTED--"

  tags = {
    key1 = "value1"
  }
}

Applied and state:

$ terraform apply
...
An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  # aws_organizations_account.bflad-dev2 will be updated in-place
  ~ resource "aws_organizations_account" "bflad-dev2" {
        arn           = "arn:aws:organizations::--OMITTED--:account/o-p687o6l073/--OMITTED--"
        email         = "--OMITTED--"
        id            = "--OMITTED--"
        joined_method = "INVITED"
        name          = "bflad-dev2"
        parent_id     = "r-cg2b"
        status        = "ACTIVE"
      ~ tags          = {
          + "key1" = "value1"
        }
    }

Plan: 0 to add, 1 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

aws_organizations_account.bflad-dev2: Modifying... [id=--OMITTED--]
aws_organizations_account.bflad-dev2: Modifications complete after 0s [id=--OMITTED--]

Apply complete! Resources: 0 added, 1 changed, 0 destroyed.

$ terraform state show aws_organizations_account.bflad-dev2
resource "aws_organizations_account" "bflad-dev2" {
    arn           = "arn:aws:organizations::--OMITTED--:account/o-p687o6l073/--OMITTED--"
    email         = "--OMITTED--"
    id            = "--OMITTED--"
    joined_method = "INVITED"
    name          = "bflad-dev2"
    parent_id     = "r-cg2b"
    status        = "ACTIVE"
    tags          = {
        "key1" = "value1"
    }
}

Updated configuration:

resource "aws_organizations_account" "bflad-dev2" {
  name  = "bflad-dev2"
  email = "--OMITTED--"

  tags = {
    key1 = "value1updated"
    key2 = "value2"
  }
}

Applied and state:

$ terraform apply
...
An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  # aws_organizations_account.bflad-dev2 will be updated in-place
  ~ resource "aws_organizations_account" "bflad-dev2" {
        arn           = "arn:aws:organizations::--OMITTED--:account/o-p687o6l073/--OMITTED--"
        email         = "--OMITTED--"
        id            = "--OMITTED--"
        joined_method = "INVITED"
        name          = "bflad-dev2"
        parent_id     = "r-cg2b"
        status        = "ACTIVE"
      ~ tags          = {
          ~ "key1" = "value1" -> "value1updated"
          + "key2" = "value2"
        }
    }

Plan: 0 to add, 1 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

aws_organizations_account.bflad-dev2: Modifying... [id=--OMITTED--]
aws_organizations_account.bflad-dev2: Modifications complete after 1s [id=--OMITTED--]

Apply complete! Resources: 0 added, 1 changed, 0 destroyed.

$ terraform state show aws_organizations_account.bflad-dev2
resource "aws_organizations_account" "bflad-dev2" {
    arn           = "arn:aws:organizations::--OMITTED--:account/o-p687o6l073/--OMITTED--"
    email         = "--OMITTED--"
    id            = "--OMITTED--"
    joined_method = "INVITED"
    name          = "bflad-dev2"
    parent_id     = "r-cg2b"
    status        = "ACTIVE"
    tags          = {
        "key1" = "value1updated"
        "key2" = "value2"
    }
}

Updated configuration:

resource "aws_organizations_account" "bflad-dev2" {
  name  = "bflad-dev2"
  email = "--OMITTED--"
}

Applied and state:

$ terraform apply
...
An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  # aws_organizations_account.bflad-dev2 will be updated in-place
  ~ resource "aws_organizations_account" "bflad-dev2" {
        arn           = "arn:aws:organizations::--OMITTED--:account/o-p687o6l073/--OMITTED--"
        email         = "--OMITTED--"
        id            = "--OMITTED--"
        joined_method = "INVITED"
        name          = "bflad-dev2"
        parent_id     = "r-cg2b"
        status        = "ACTIVE"
      ~ tags          = {
          - "key1" = "value1updated" -> null
          - "key2" = "value2" -> null
        }
    }

Plan: 0 to add, 1 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

aws_organizations_account.bflad-dev2: Modifying... [id=--OMITTED--]
aws_organizations_account.bflad-dev2: Modifications complete after 0s [id=--OMITTED--]

Apply complete! Resources: 0 added, 1 changed, 0 destroyed.

$ terraform state show aws_organizations_account.bflad-dev2
resource "aws_organizations_account" "bflad-dev2" {
    arn           = "arn:aws:organizations::--OMITTED--:account/o-p687o6l073/--OMITTED--"
    email         = "--OMITTED--"
    id            = "--OMITTED--"
    joined_method = "INVITED"
    name          = "bflad-dev2"
    parent_id     = "r-cg2b"
    status        = "ACTIVE"
    tags          = {}
}

Reference: #8896

AWS Organizations Account testing is manual due to the lack of an automated deletion APIs. Manually verified with locally updated Terraform AWS Provider binary.

Starting configuration:

```hcl
resource "aws_organizations_account" "bflad-dev2" {
  name  = "bflad-dev2"
  email = "--OMITTED--"
}
```

Planned:

```console
$ terraform plan
...
No changes. Infrastructure is up-to-date.
```

Updated configuration:

```hcl
resource "aws_organizations_account" "bflad-dev2" {
  name  = "bflad-dev2"
  email = "--OMITTED--"

  tags = {
    key1 = "value1"
  }
}
```

Applied and state:

```console
$ terraform apply
...
An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  # aws_organizations_account.bflad-dev2 will be updated in-place
  ~ resource "aws_organizations_account" "bflad-dev2" {
        arn           = "arn:aws:organizations::--OMITTED--:account/o-p687o6l073/--OMITTED--"
        email         = "--OMITTED--"
        id            = "--OMITTED--"
        joined_method = "INVITED"
        name          = "bflad-dev2"
        parent_id     = "r-cg2b"
        status        = "ACTIVE"
      ~ tags          = {
          + "key1" = "value1"
        }
    }

Plan: 0 to add, 1 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

aws_organizations_account.bflad-dev2: Modifying... [id=--OMITTED--]
aws_organizations_account.bflad-dev2: Modifications complete after 0s [id=--OMITTED--]

Apply complete! Resources: 0 added, 1 changed, 0 destroyed.

$ terraform state show aws_organizations_account.bflad-dev2
resource "aws_organizations_account" "bflad-dev2" {
    arn           = "arn:aws:organizations::--OMITTED--:account/o-p687o6l073/--OMITTED--"
    email         = "--OMITTED--"
    id            = "--OMITTED--"
    joined_method = "INVITED"
    name          = "bflad-dev2"
    parent_id     = "r-cg2b"
    status        = "ACTIVE"
    tags          = {
        "key1" = "value1"
    }
}
```

Updated configuration:

```hcl
resource "aws_organizations_account" "bflad-dev2" {
  name  = "bflad-dev2"
  email = "--OMITTED--"

  tags = {
    key1 = "value1updated"
    key2 = "value2"
  }
}
```

Applied and state:

```console
$ terraform apply
...
An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  # aws_organizations_account.bflad-dev2 will be updated in-place
  ~ resource "aws_organizations_account" "bflad-dev2" {
        arn           = "arn:aws:organizations::--OMITTED--:account/o-p687o6l073/--OMITTED--"
        email         = "--OMITTED--"
        id            = "--OMITTED--"
        joined_method = "INVITED"
        name          = "bflad-dev2"
        parent_id     = "r-cg2b"
        status        = "ACTIVE"
      ~ tags          = {
          ~ "key1" = "value1" -> "value1updated"
          + "key2" = "value2"
        }
    }

Plan: 0 to add, 1 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

aws_organizations_account.bflad-dev2: Modifying... [id=--OMITTED--]
aws_organizations_account.bflad-dev2: Modifications complete after 1s [id=--OMITTED--]

Apply complete! Resources: 0 added, 1 changed, 0 destroyed.

$ terraform state show aws_organizations_account.bflad-dev2
resource "aws_organizations_account" "bflad-dev2" {
    arn           = "arn:aws:organizations::--OMITTED--:account/o-p687o6l073/--OMITTED--"
    email         = "--OMITTED--"
    id            = "--OMITTED--"
    joined_method = "INVITED"
    name          = "bflad-dev2"
    parent_id     = "r-cg2b"
    status        = "ACTIVE"
    tags          = {
        "key1" = "value1updated"
        "key2" = "value2"
    }
}
```

Updated configuration:

```hcl
resource "aws_organizations_account" "bflad-dev2" {
  name  = "bflad-dev2"
  email = "--OMITTED--"
}
```

Applied and state:

```console
$ terraform apply
...
An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  # aws_organizations_account.bflad-dev2 will be updated in-place
  ~ resource "aws_organizations_account" "bflad-dev2" {
        arn           = "arn:aws:organizations::--OMITTED--:account/o-p687o6l073/--OMITTED--"
        email         = "--OMITTED--"
        id            = "--OMITTED--"
        joined_method = "INVITED"
        name          = "bflad-dev2"
        parent_id     = "r-cg2b"
        status        = "ACTIVE"
      ~ tags          = {
          - "key1" = "value1updated" -> null
          - "key2" = "value2" -> null
        }
    }

Plan: 0 to add, 1 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

aws_organizations_account.bflad-dev2: Modifying... [id=--OMITTED--]
aws_organizations_account.bflad-dev2: Modifications complete after 0s [id=--OMITTED--]

Apply complete! Resources: 0 added, 1 changed, 0 destroyed.

$ terraform state show aws_organizations_account.bflad-dev2
resource "aws_organizations_account" "bflad-dev2" {
    arn           = "arn:aws:organizations::--OMITTED--:account/o-p687o6l073/--OMITTED--"
    email         = "--OMITTED--"
    id            = "--OMITTED--"
    joined_method = "INVITED"
    name          = "bflad-dev2"
    parent_id     = "r-cg2b"
    status        = "ACTIVE"
    tags          = {}
}
```
@bflad bflad added enhancement Requests to existing resources that expand the functionality or scope. service/organizations Issues and PRs that pertain to the organizations service. labels Jul 2, 2019
@bflad bflad requested a review from a team July 2, 2019 13:17
@ghost ghost added size/XL Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. documentation Introduces or discusses updates to documentation. labels Jul 2, 2019
…t_Tags test is included in TestAccAWSOrganizations
Copy link
Member

@nywilken nywilken left a comment

Choose a reason for hiding this comment

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

LGTM 👍 👍

@bflad bflad added this to the v2.19.0 milestone Jul 8, 2019
@bflad bflad merged commit e42fd9d into master Jul 8, 2019
@bflad bflad deleted the f-aws_organizations_account-tags branch July 8, 2019 22:34
bflad added a commit that referenced this pull request Jul 8, 2019
@bflad
Copy link
Member Author

bflad commented Jul 11, 2019

This has been released in version 2.19.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 Nov 2, 2019

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 Nov 2, 2019
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/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.

AWS Organizations account tagging
2 participants