OpsLevel / terraform-provider-opslevel

Terraform provider for OpsLevel.com
https://registry.terraform.io/providers/OpsLevel/opslevel/latest/docs
MIT License
8 stars 5 forks source link

fix resource `opslevel_service` - enable use of non-default `owner` aliases, enable unsetting `owner` #333

Closed taimoorgit closed 4 months ago

taimoorgit commented 4 months ago

Issues

https://github.com/OpsLevel/team-platform/issues/344 AND https://github.com/OpsLevel/team-platform/issues/362

Changelog

Tophatting

Making sure to run task plan after every step to ensure there's no infinite changes loop because of a mismatch between plan vs state.

Can create the service with no team

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:

  # opslevel_service.mon_service will be created
  + resource "opslevel_service" "mon_service" {
      + id           = (known after apply)
      + last_updated = (known after apply)
      + name         = "My New Service Hello World"
    }

Plan: 1 to add, 0 to change, 0 to destroy.
opslevel_service.mon_service: Creating...
opslevel_service.mon_service: Creation complete after 0s [id=Z2lkOi8vb3BzbGV2ZWwvU2VydmljZS8xMjIxMzA]

Can create the service with a team

Terraform will perform the following actions:

  # opslevel_service.mon_service will be created
  + resource "opslevel_service" "mon_service" {
      + id           = (known after apply)
      + last_updated = (known after apply)
      + name         = "My New Service Hello World"
      + owner        = "team_platform_3_a"
    }

Plan: 1 to add, 0 to change, 0 to destroy.
opslevel_service.mon_service: Creating...
opslevel_service.mon_service: Creation complete after 0s [id=Z2lkOi8vb3BzbGV2ZWwvU2VydmljZS8xMjIxMzE]

Service - Can change to using the same team, but with a non-default alias for that team

Terraform will perform the following actions:

  # opslevel_service.mon_service will be updated in-place
  ~ resource "opslevel_service" "mon_service" {
        id           = "Z2lkOi8vb3BzbGV2ZWwvU2VydmljZS8xMjIxMzE"
      + last_updated = (known after apply)
        name         = "My New Service Hello World"
      ~ owner        = "team_platform_3_a" -> "third_platform"
    }

Plan: 0 to add, 1 to change, 0 to destroy.
opslevel_service.mon_service: Modifying... [id=Z2lkOi8vb3BzbGV2ZWwvU2VydmljZS8xMjIxMzE]
opslevel_service.mon_service: Modifications complete after 1s [id=Z2lkOi8vb3BzbGV2ZWwvU2VydmljZS8xMjIxMzE]

Service - Can change to using the ID of that team

Terraform will perform the following actions:

  # opslevel_service.mon_service will be updated in-place
  ~ resource "opslevel_service" "mon_service" {
        id           = "Z2lkOi8vb3BzbGV2ZWwvU2VydmljZS8xMjIxMzE"
      + last_updated = (known after apply)
        name         = "My New Service Hello World"
      ~ owner        = "third_platform" -> "Z2lkOi8vb3BzbGV2ZWwvVGVhbS8xNzQzNA"
    }

Plan: 0 to add, 1 to change, 0 to destroy.
opslevel_service.mon_service: Modifying... [id=Z2lkOi8vb3BzbGV2ZWwvU2VydmljZS8xMjIxMzE]
opslevel_service.mon_service: Modifications complete after 1s [id=Z2lkOi8vb3BzbGV2ZWwvU2VydmljZS8xMjIxMzE]

Service - Can unset the team

Terraform will perform the following actions:

  # opslevel_service.mon_service will be updated in-place
  ~ resource "opslevel_service" "mon_service" {
        id           = "Z2lkOi8vb3BzbGV2ZWwvU2VydmljZS8xMjIxMzE"
      + last_updated = (known after apply)
        name         = "My New Service Hello World"
      - owner        = "Z2lkOi8vb3BzbGV2ZWwvVGVhbS8xNzQzNA" -> null
    }

Plan: 0 to add, 1 to change, 0 to destroy.
opslevel_service.mon_service: Modifying... [id=Z2lkOi8vb3BzbGV2ZWwvU2VydmljZS8xMjIxMzE]
opslevel_service.mon_service: Modifications complete after 1s [id=Z2lkOi8vb3BzbGV2ZWwvU2VydmljZS8xMjIxMzE]