```
❯ terraform plan
Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
+ create
Terraform will perform the following actions:
# tabular_role.example will be created
+ resource "tabular_role" "example" {
+ force_destroy = true
+ id = (known after apply)
+ name = "Example Role 1"
}
# tabular_role.example2 will be created
+ resource "tabular_role" "example2" {
+ force_destroy = true
+ id = (known after apply)
+ name = "Example Role 2"
}
# tabular_role.example3 will be created
+ resource "tabular_role" "example3" {
+ force_destroy = true
+ id = (known after apply)
+ name = "Example Role 3"
}
# tabular_role_relationship.inheritance will be created
+ resource "tabular_role_relationship" "inheritance" {
+ child_role_name = "Example Role 2"
+ parent_role_name = "Example Role 1"
}
Plan: 4 to add, 0 to change, 0 to destroy.
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Note: You didn't use the -out option to save this plan, so Terraform can't guarantee to take exactly these actions if you run "terraform apply" now.
```
Apply
```
❯ terraform apply
Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
+ create
Terraform will perform the following actions:
# tabular_role.example will be created
+ resource "tabular_role" "example" {
+ force_destroy = true
+ id = (known after apply)
+ name = "Example Role 1"
}
# tabular_role.example2 will be created
+ resource "tabular_role" "example2" {
+ force_destroy = true
+ id = (known after apply)
+ name = "Example Role 2"
}
# tabular_role.example3 will be created
+ resource "tabular_role" "example3" {
+ force_destroy = true
+ id = (known after apply)
+ name = "Example Role 3"
}
# tabular_role_relationship.inheritance will be created
+ resource "tabular_role_relationship" "inheritance" {
+ child_role_name = "Example Role 2"
+ parent_role_name = "Example Role 1"
}
Plan: 4 to add, 0 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
tabular_role.example2: Creating...
tabular_role.example3: Creating...
tabular_role.example: Creating...
tabular_role.example2: Creation complete after 0s [id=fa8f6ced-f7fc-4cde-bcd2-2d8c56b0f1e5]
tabular_role.example: Creation complete after 0s [id=ce8f2863-c060-412b-937a-bb3be0401082]
tabular_role.example3: Creation complete after 0s [id=6de22ab3-293c-417c-8fe4-99081a077abf]
tabular_role_relationship.inheritance: Creating...
tabular_role_relationship.inheritance: Creation complete after 0s
Apply complete! Resources: 4 added, 0 changed, 0 destroyed.
```
Imports
```
❯ terraform state rm tabular_role.example2
Removed tabular_role.example2
Successfully removed 1 resource instance(s).
❯ terraform import tabular_role.example2 "Example Role 4"
tabular_role.example2: Importing from ID "Example Role 4"...
tabular_role.example2: Import prepared!
Prepared tabular_role for import
tabular_role.example2: Refreshing state...
Import successful!
The resources that were imported are shown above. These resources are now in
your Terraform state and will henceforth be managed by Terraform.
```
```
❯ terraform state rm tabular_role_relationship.inheritance
Removed tabular_role_relationship.inheritance
Successfully removed 1 resource instance(s).
❯ terraform import tabular_role_relationship.inheritance "Example Role 1/Example Role 2"
tabular_role_relationship.inheritance: Importing from ID "Example Role 1/Example Role 2"...
tabular_role_relationship.inheritance: Import prepared!
Prepared tabular_role_relationship for import
tabular_role_relationship.inheritance: Refreshing state...
Import successful!
The resources that were imported are shown above. These resources are now in
your Terraform state and will henceforth be managed by Terraform.
```
Updates
```
❯ sed -i 's/tabular_role.example2.name/tabular_role.example3.name/' provider.tf
❯ terraform apply
tabular_role.example: Refreshing state... [id=ce8f2863-c060-412b-937a-bb3be0401082]
tabular_role.example2: Refreshing state... [id=fa8f6ced-f7fc-4cde-bcd2-2d8c56b0f1e5]
tabular_role.example3: Refreshing state... [id=6de22ab3-293c-417c-8fe4-99081a077abf]
tabular_role_relationship.inheritance: Refreshing state...
Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
-/+ destroy and then create replacement
Terraform will perform the following actions:
# tabular_role_relationship.inheritance must be replaced
-/+ resource "tabular_role_relationship" "inheritance" {
~ child_role_name = "Example Role 2" -> "Example Role 3" # forces replacement
# (1 unchanged attribute hidden)
}
Plan: 1 to add, 0 to change, 1 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
tabular_role_relationship.inheritance: Destroying...
tabular_role_relationship.inheritance: Destruction complete after 0s
tabular_role_relationship.inheritance: Creating...
tabular_role_relationship.inheritance: Creation complete after 0s
Apply complete! Resources: 1 added, 0 changed, 1 destroyed.
```
```
❯ sed -i 's/Example Role 2/Example Role 4/' provider.tf
❯ terraform apply
tabular_role.example2: Refreshing state... [id=fa8f6ced-f7fc-4cde-bcd2-2d8c56b0f1e5]
tabular_role.example: Refreshing state... [id=ce8f2863-c060-412b-937a-bb3be0401082]
tabular_role.example3: Refreshing state... [id=6de22ab3-293c-417c-8fe4-99081a077abf]
tabular_role_relationship.inheritance: Refreshing state...
Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
~ update in-place
-/+ destroy and then create replacement
Terraform will perform the following actions:
# tabular_role.example2 will be updated in-place
~ resource "tabular_role" "example2" {
id = "fa8f6ced-f7fc-4cde-bcd2-2d8c56b0f1e5"
~ name = "Example Role 2" -> "Example Role 4"
# (1 unchanged attribute hidden)
}
# tabular_role_relationship.inheritance must be replaced
-/+ resource "tabular_role_relationship" "inheritance" {
~ child_role_name = "Example Role 2" -> "Example Role 4" # forces replacement
# (1 unchanged attribute hidden)
}
Plan: 1 to add, 1 to change, 1 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
tabular_role_relationship.inheritance: Destroying...
tabular_role_relationship.inheritance: Destruction complete after 0s
tabular_role.example2: Modifying... [id=fa8f6ced-f7fc-4cde-bcd2-2d8c56b0f1e5]
tabular_role.example2: Modifications complete after 0s [id=fa8f6ced-f7fc-4cde-bcd2-2d8c56b0f1e5]
tabular_role_relationship.inheritance: Creating...
tabular_role_relationship.inheritance: Creation complete after 0s
Apply complete! Resources: 1 added, 1 changed, 1 destroyed.
```
Destroy
```
❯ terraform apply
Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
+ create
Terraform will perform the following actions:
# tabular_role.example will be created
+ resource "tabular_role" "example" {
+ force_destroy = true
+ id = (known after apply)
+ name = "Example Role 1"
}
# tabular_role.example2 will be created
+ resource "tabular_role" "example2" {
+ force_destroy = true
+ id = (known after apply)
+ name = "Example Role 2"
}
# tabular_role.example3 will be created
+ resource "tabular_role" "example3" {
+ force_destroy = true
+ id = (known after apply)
+ name = "Example Role 3"
}
# tabular_role_relationship.inheritance will be created
+ resource "tabular_role_relationship" "inheritance" {
+ child_role_name = "Example Role 2"
+ parent_role_name = "Example Role 1"
}
Plan: 4 to add, 0 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
tabular_role.example3: Creating...
tabular_role.example2: Creating...
tabular_role.example: Creating...
tabular_role.example3: Creation complete after 0s [id=50b6d4ad-6093-4f3f-a87d-4231146a16e0]
tabular_role.example2: Creation complete after 0s [id=ba659409-42df-454a-a9b6-9ce436d460d2]
tabular_role.example: Creation complete after 0s [id=42836efc-3f2f-43e5-9484-48fa60fcbf3d]
tabular_role_relationship.inheritance: Creating...
tabular_role_relationship.inheritance: Creation complete after 0s
Apply complete! Resources: 4 added, 0 changed, 0 destroyed.
```
Examples
``` ❯ terraform plan Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols: + create Terraform will perform the following actions: # tabular_role.example will be created + resource "tabular_role" "example" { + force_destroy = true + id = (known after apply) + name = "Example Role 1" } # tabular_role.example2 will be created + resource "tabular_role" "example2" { + force_destroy = true + id = (known after apply) + name = "Example Role 2" } # tabular_role.example3 will be created + resource "tabular_role" "example3" { + force_destroy = true + id = (known after apply) + name = "Example Role 3" } # tabular_role_relationship.inheritance will be created + resource "tabular_role_relationship" "inheritance" { + child_role_name = "Example Role 2" + parent_role_name = "Example Role 1" } Plan: 4 to add, 0 to change, 0 to destroy. ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── Note: You didn't use the -out option to save this plan, so Terraform can't guarantee to take exactly these actions if you run "terraform apply" now. ```Plan
``` ❯ terraform apply Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols: + create Terraform will perform the following actions: # tabular_role.example will be created + resource "tabular_role" "example" { + force_destroy = true + id = (known after apply) + name = "Example Role 1" } # tabular_role.example2 will be created + resource "tabular_role" "example2" { + force_destroy = true + id = (known after apply) + name = "Example Role 2" } # tabular_role.example3 will be created + resource "tabular_role" "example3" { + force_destroy = true + id = (known after apply) + name = "Example Role 3" } # tabular_role_relationship.inheritance will be created + resource "tabular_role_relationship" "inheritance" { + child_role_name = "Example Role 2" + parent_role_name = "Example Role 1" } Plan: 4 to add, 0 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 tabular_role.example2: Creating... tabular_role.example3: Creating... tabular_role.example: Creating... tabular_role.example2: Creation complete after 0s [id=fa8f6ced-f7fc-4cde-bcd2-2d8c56b0f1e5] tabular_role.example: Creation complete after 0s [id=ce8f2863-c060-412b-937a-bb3be0401082] tabular_role.example3: Creation complete after 0s [id=6de22ab3-293c-417c-8fe4-99081a077abf] tabular_role_relationship.inheritance: Creating... tabular_role_relationship.inheritance: Creation complete after 0s Apply complete! Resources: 4 added, 0 changed, 0 destroyed. ```Apply
``` ❯ terraform state rm tabular_role.example2 Removed tabular_role.example2 Successfully removed 1 resource instance(s). ❯ terraform import tabular_role.example2 "Example Role 4" tabular_role.example2: Importing from ID "Example Role 4"... tabular_role.example2: Import prepared! Prepared tabular_role for import tabular_role.example2: Refreshing state... Import successful! The resources that were imported are shown above. These resources are now in your Terraform state and will henceforth be managed by Terraform. ``` ``` ❯ terraform state rm tabular_role_relationship.inheritance Removed tabular_role_relationship.inheritance Successfully removed 1 resource instance(s). ❯ terraform import tabular_role_relationship.inheritance "Example Role 1/Example Role 2" tabular_role_relationship.inheritance: Importing from ID "Example Role 1/Example Role 2"... tabular_role_relationship.inheritance: Import prepared! Prepared tabular_role_relationship for import tabular_role_relationship.inheritance: Refreshing state... Import successful! The resources that were imported are shown above. These resources are now in your Terraform state and will henceforth be managed by Terraform. ```Imports
``` ❯ sed -i 's/tabular_role.example2.name/tabular_role.example3.name/' provider.tf ❯ terraform apply tabular_role.example: Refreshing state... [id=ce8f2863-c060-412b-937a-bb3be0401082] tabular_role.example2: Refreshing state... [id=fa8f6ced-f7fc-4cde-bcd2-2d8c56b0f1e5] tabular_role.example3: Refreshing state... [id=6de22ab3-293c-417c-8fe4-99081a077abf] tabular_role_relationship.inheritance: Refreshing state... Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols: -/+ destroy and then create replacement Terraform will perform the following actions: # tabular_role_relationship.inheritance must be replaced -/+ resource "tabular_role_relationship" "inheritance" { ~ child_role_name = "Example Role 2" -> "Example Role 3" # forces replacement # (1 unchanged attribute hidden) } Plan: 1 to add, 0 to change, 1 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 tabular_role_relationship.inheritance: Destroying... tabular_role_relationship.inheritance: Destruction complete after 0s tabular_role_relationship.inheritance: Creating... tabular_role_relationship.inheritance: Creation complete after 0s Apply complete! Resources: 1 added, 0 changed, 1 destroyed. ``` ``` ❯ sed -i 's/Example Role 2/Example Role 4/' provider.tf ❯ terraform apply tabular_role.example2: Refreshing state... [id=fa8f6ced-f7fc-4cde-bcd2-2d8c56b0f1e5] tabular_role.example: Refreshing state... [id=ce8f2863-c060-412b-937a-bb3be0401082] tabular_role.example3: Refreshing state... [id=6de22ab3-293c-417c-8fe4-99081a077abf] tabular_role_relationship.inheritance: Refreshing state... Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols: ~ update in-place -/+ destroy and then create replacement Terraform will perform the following actions: # tabular_role.example2 will be updated in-place ~ resource "tabular_role" "example2" { id = "fa8f6ced-f7fc-4cde-bcd2-2d8c56b0f1e5" ~ name = "Example Role 2" -> "Example Role 4" # (1 unchanged attribute hidden) } # tabular_role_relationship.inheritance must be replaced -/+ resource "tabular_role_relationship" "inheritance" { ~ child_role_name = "Example Role 2" -> "Example Role 4" # forces replacement # (1 unchanged attribute hidden) } Plan: 1 to add, 1 to change, 1 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 tabular_role_relationship.inheritance: Destroying... tabular_role_relationship.inheritance: Destruction complete after 0s tabular_role.example2: Modifying... [id=fa8f6ced-f7fc-4cde-bcd2-2d8c56b0f1e5] tabular_role.example2: Modifications complete after 0s [id=fa8f6ced-f7fc-4cde-bcd2-2d8c56b0f1e5] tabular_role_relationship.inheritance: Creating... tabular_role_relationship.inheritance: Creation complete after 0s Apply complete! Resources: 1 added, 1 changed, 1 destroyed. ```Updates
``` ❯ terraform apply Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols: + create Terraform will perform the following actions: # tabular_role.example will be created + resource "tabular_role" "example" { + force_destroy = true + id = (known after apply) + name = "Example Role 1" } # tabular_role.example2 will be created + resource "tabular_role" "example2" { + force_destroy = true + id = (known after apply) + name = "Example Role 2" } # tabular_role.example3 will be created + resource "tabular_role" "example3" { + force_destroy = true + id = (known after apply) + name = "Example Role 3" } # tabular_role_relationship.inheritance will be created + resource "tabular_role_relationship" "inheritance" { + child_role_name = "Example Role 2" + parent_role_name = "Example Role 1" } Plan: 4 to add, 0 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 tabular_role.example3: Creating... tabular_role.example2: Creating... tabular_role.example: Creating... tabular_role.example3: Creation complete after 0s [id=50b6d4ad-6093-4f3f-a87d-4231146a16e0] tabular_role.example2: Creation complete after 0s [id=ba659409-42df-454a-a9b6-9ce436d460d2] tabular_role.example: Creation complete after 0s [id=42836efc-3f2f-43e5-9484-48fa60fcbf3d] tabular_role_relationship.inheritance: Creating... tabular_role_relationship.inheritance: Creation complete after 0s Apply complete! Resources: 4 added, 0 changed, 0 destroyed. ```Destroy