Closed davidbloss closed 2 months ago
aliases field has issues
Convert aliases field in opslevel_infrastructure, opslevel_service, and opslevel_team from list type to set. This is a sensible solution to the unordered nature of aliases on return.
aliases
opslevel_infrastructure
opslevel_service
opslevel_team
changie
# main.tf resource "opslevel_infrastructure" "example" { aliases = [] owner = "Z2lkOi8vb3BzbGV2ZWwvVGVhbS8xNzQzMg" schema = "Database" data = jsonencode({ name = "my-database" }) } resource "opslevel_service" "example" { name = "frosting-patrol1" aliases = [] } resource "opslevel_team" "example" { name = "bake-off2" responsibilities = "Baking cakes" aliases = [] }
terraform apply
opslevel_team.example: Refreshing state... [id=Z2lkOi8vb3BzbGV2ZWwvVGVhbS8xOTE2Mg] opslevel_infrastructure.example: Refreshing state... [id=Z2lkOi8vb3BzbGV2ZWwvRW50aXR5T2JqZWN0LzI0OTgyMTk] opslevel_service.example: Refreshing state... [id=Z2lkOi8vb3BzbGV2ZWwvU2VydmljZS8xMjQwMDQ] Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols: ~ update in-place Terraform will perform the following actions: # opslevel_infrastructure.example will be updated in-place ~ resource "opslevel_infrastructure" "example" { + aliases = [] id = "Z2lkOi8vb3BzbGV2ZWwvRW50aXR5T2JqZWN0LzI0OTgyMTk" # (3 unchanged attributes hidden) } # opslevel_service.example will be updated in-place ~ resource "opslevel_service" "example" { + aliases = [] id = "Z2lkOi8vb3BzbGV2ZWwvU2VydmljZS8xMjQwMDQ" name = "frosting-patrol1" } # opslevel_team.example will be updated in-place ~ resource "opslevel_team" "example" { + aliases = [] id = "Z2lkOi8vb3BzbGV2ZWwvVGVhbS8xOTE2Mg" name = "bake-off2" # (1 unchanged attribute hidden) } Plan: 0 to add, 3 to change, 0 to destroy. opslevel_team.example: Modifying... [id=Z2lkOi8vb3BzbGV2ZWwvVGVhbS8xOTE2Mg] opslevel_infrastructure.example: Modifying... [id=Z2lkOi8vb3BzbGV2ZWwvRW50aXR5T2JqZWN0LzI0OTgyMTk] opslevel_service.example: Modifying... [id=Z2lkOi8vb3BzbGV2ZWwvU2VydmljZS8xMjQwMDQ] opslevel_team.example: Modifications complete after 0s [id=Z2lkOi8vb3BzbGV2ZWwvVGVhbS8xOTE2Mg] opslevel_infrastructure.example: Modifications complete after 0s [id=Z2lkOi8vb3BzbGV2ZWwvRW50aXR5T2JqZWN0LzI0OTgyMTk] opslevel_service.example: Modifications complete after 1s [id=Z2lkOi8vb3BzbGV2ZWwvU2VydmljZS8xMjQwMDQ] Apply complete! Resources: 0 added, 3 changed, 0 destroyed.
resource "opslevel_infrastructure" "example" { aliases = ["lkasjd121fkj12", "b342ufyoiayw12"] owner = "Z2lkOi8vb3BzbGV2ZWwvVGVhbS8xNzQzMg" schema = "Database" data = jsonencode({ name = "my-database" }) } resource "opslevel_service" "example" { name = "frosting-patrol1" aliases = ["lkasjdfkj12", "bufyoiayw12"] } resource "opslevel_team" "example" { name = "bake-off2" responsibilities = "Baking cakes" aliases = ["lkasjdfkj", "bufyoiayw"] }
opslevel_team.example: Refreshing state... [id=Z2lkOi8vb3BzbGV2ZWwvVGVhbS8xOTE2Mg] opslevel_service.example: Refreshing state... [id=Z2lkOi8vb3BzbGV2ZWwvU2VydmljZS8xMjQwMDQ] opslevel_infrastructure.example: Refreshing state... [id=Z2lkOi8vb3BzbGV2ZWwvRW50aXR5T2JqZWN0LzI0OTgyMTk] Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols: ~ update in-place Terraform will perform the following actions: # opslevel_infrastructure.example will be updated in-place ~ resource "opslevel_infrastructure" "example" { ~ aliases = [ + "b342ufyoiayw12", + "lkasjd121fkj12", ] id = "Z2lkOi8vb3BzbGV2ZWwvRW50aXR5T2JqZWN0LzI0OTgyMTk" # (3 unchanged attributes hidden) } # opslevel_service.example will be updated in-place ~ resource "opslevel_service" "example" { ~ aliases = [ + "bufyoiayw12", + "lkasjdfkj12", ] id = "Z2lkOi8vb3BzbGV2ZWwvU2VydmljZS8xMjQwMDQ" name = "frosting-patrol1" } # opslevel_team.example will be updated in-place ~ resource "opslevel_team" "example" { ~ aliases = [ + "bufyoiayw", + "lkasjdfkj", ] id = "Z2lkOi8vb3BzbGV2ZWwvVGVhbS8xOTE2Mg" name = "bake-off2" # (1 unchanged attribute hidden) } Plan: 0 to add, 3 to change, 0 to destroy. opslevel_infrastructure.example: Modifying... [id=Z2lkOi8vb3BzbGV2ZWwvRW50aXR5T2JqZWN0LzI0OTgyMTk] opslevel_service.example: Modifying... [id=Z2lkOi8vb3BzbGV2ZWwvU2VydmljZS8xMjQwMDQ] opslevel_team.example: Modifying... [id=Z2lkOi8vb3BzbGV2ZWwvVGVhbS8xOTE2Mg] opslevel_team.example: Modifications complete after 1s [id=Z2lkOi8vb3BzbGV2ZWwvVGVhbS8xOTE2Mg] opslevel_infrastructure.example: Modifications complete after 1s [id=Z2lkOi8vb3BzbGV2ZWwvRW50aXR5T2JqZWN0LzI0OTgyMTk] opslevel_service.example: Modifications complete after 2s [id=Z2lkOi8vb3BzbGV2ZWwvU2VydmljZS8xMjQwMDQ] Apply complete! Resources: 0 added, 3 changed, 0 destroyed.
resource "opslevel_infrastructure" "example" { # aliases = ["lkasjd121fkj12", "b342ufyoiayw12"] owner = "Z2lkOi8vb3BzbGV2ZWwvVGVhbS8xNzQzMg" schema = "Database" data = jsonencode({ name = "my-database" }) } resource "opslevel_service" "example" { name = "frosting-patrol1" # aliases = ["lkasjdfkj12", "bufyoiayw12"] } resource "opslevel_team" "example" { name = "bake-off2" responsibilities = "Baking cakes" # aliases = ["lkasjdfkj", "bufyoiayw"] }
opslevel_team.example: Refreshing state... [id=Z2lkOi8vb3BzbGV2ZWwvVGVhbS8xOTE2Mg] opslevel_infrastructure.example: Refreshing state... [id=Z2lkOi8vb3BzbGV2ZWwvRW50aXR5T2JqZWN0LzI0OTgyMTk] opslevel_service.example: Refreshing state... [id=Z2lkOi8vb3BzbGV2ZWwvU2VydmljZS8xMjQwMDQ] Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols: ~ update in-place Terraform will perform the following actions: # opslevel_infrastructure.example will be updated in-place ~ resource "opslevel_infrastructure" "example" { - aliases = [] -> null id = "Z2lkOi8vb3BzbGV2ZWwvRW50aXR5T2JqZWN0LzI0OTgyMTk" # (3 unchanged attributes hidden) } # opslevel_service.example will be updated in-place ~ resource "opslevel_service" "example" { - aliases = [] -> null id = "Z2lkOi8vb3BzbGV2ZWwvU2VydmljZS8xMjQwMDQ" name = "frosting-patrol1" } # opslevel_team.example will be updated in-place ~ resource "opslevel_team" "example" { - aliases = [] -> null id = "Z2lkOi8vb3BzbGV2ZWwvVGVhbS8xOTE2Mg" name = "bake-off2" # (1 unchanged attribute hidden) } Plan: 0 to add, 3 to change, 0 to destroy. opslevel_infrastructure.example: Modifying... [id=Z2lkOi8vb3BzbGV2ZWwvRW50aXR5T2JqZWN0LzI0OTgyMTk] opslevel_service.example: Modifying... [id=Z2lkOi8vb3BzbGV2ZWwvU2VydmljZS8xMjQwMDQ] opslevel_team.example: Modifying... [id=Z2lkOi8vb3BzbGV2ZWwvVGVhbS8xOTE2Mg] opslevel_team.example: Modifications complete after 0s [id=Z2lkOi8vb3BzbGV2ZWwvVGVhbS8xOTE2Mg] opslevel_infrastructure.example: Modifications complete after 0s [id=Z2lkOi8vb3BzbGV2ZWwvRW50aXR5T2JqZWN0LzI0OTgyMTk] opslevel_service.example: Modifications complete after 1s [id=Z2lkOi8vb3BzbGV2ZWwvU2VydmljZS8xMjQwMDQ] Apply complete! Resources: 0 added, 3 changed, 0 destroyed.
terraform destroy
opslevel_team.example: Refreshing state... [id=Z2lkOi8vb3BzbGV2ZWwvVGVhbS8xOTE2Mg] opslevel_infrastructure.example: Refreshing state... [id=Z2lkOi8vb3BzbGV2ZWwvRW50aXR5T2JqZWN0LzI0OTgyMTk] opslevel_service.example: Refreshing state... [id=Z2lkOi8vb3BzbGV2ZWwvU2VydmljZS8xMjQwMDQ] Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols: - destroy Terraform will perform the following actions: # opslevel_infrastructure.example will be destroyed - resource "opslevel_infrastructure" "example" { - data = jsonencode( { - name = "my-database" } ) -> null - id = "Z2lkOi8vb3BzbGV2ZWwvRW50aXR5T2JqZWN0LzI0OTgyMTk" -> null - owner = "Z2lkOi8vb3BzbGV2ZWwvVGVhbS8xNzQzMg" -> null - schema = "Database" -> null } # opslevel_service.example will be destroyed - resource "opslevel_service" "example" { - id = "Z2lkOi8vb3BzbGV2ZWwvU2VydmljZS8xMjQwMDQ" -> null - name = "frosting-patrol1" -> null } # opslevel_team.example will be destroyed - resource "opslevel_team" "example" { - id = "Z2lkOi8vb3BzbGV2ZWwvVGVhbS8xOTE2Mg" -> null - name = "bake-off2" -> null - responsibilities = "Baking cakes" -> null } Plan: 0 to add, 0 to change, 3 to destroy. opslevel_team.example: Destroying... [id=Z2lkOi8vb3BzbGV2ZWwvVGVhbS8xOTE2Mg] opslevel_service.example: Destroying... [id=Z2lkOi8vb3BzbGV2ZWwvU2VydmljZS8xMjQwMDQ] opslevel_infrastructure.example: Destroying... [id=Z2lkOi8vb3BzbGV2ZWwvRW50aXR5T2JqZWN0LzI0OTgyMTk] opslevel_infrastructure.example: Destruction complete after 0s opslevel_team.example: Destruction complete after 0s opslevel_service.example: Destruction complete after 2s Destroy complete! Resources: 3 destroyed.
Issues
aliases field has issues
Changelog
Convert
aliases
field inopslevel_infrastructure
,opslevel_service
, andopslevel_team
from list type to set. This is a sensible solution to the unordered nature of aliases on return.changie
entryTophatting
With this config
Create resources with empty (non-null) aliases,
terraform apply
Update config, populate aliases
Update resources to add aliases,
terraform apply
Update config, remove aliases
Update resources to remove aliases (null - not empty),
terraform apply
Destroy test resources,
terraform destroy