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 `'' was not found` for resource opslevel_service on `lifecycle_alias`, `tier_alias` #331

Closed taimoorgit closed 4 months ago

taimoorgit commented 4 months ago

Issues

https://github.com/OpsLevel/team-platform/issues/356

Changelog

Tophatting

The config

# main.tf

resource "opslevel_service" "mon_service" {
  description = "hello world"
  framework = "rails"
  language = "ruby"
  lifecycle_alias = "pre-alpha"
  name = "mon_service"
  owner = "team_platform_3"
  tier_alias = "tier_4"
}

Create a service

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         = "mon_service"
    }

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

Set the owner (fails on old version because of tier, lifecycle alias)

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_service.mon_service will be updated in-place
  ~ resource "opslevel_service" "mon_service" {
        id           = "Z2lkOi8vb3BzbGV2ZWwvU2VydmljZS8xMjE4NjQ"
      + last_updated = (known after apply)
        name         = "mon_service"
      + owner        = "team_platform_3"
    }

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

Set some other fields - description, framework, tier_alias

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_service.mon_service will be updated in-place
  ~ resource "opslevel_service" "mon_service" {
      + description  = "hello world"
      + framework    = "rails"
        id           = "Z2lkOi8vb3BzbGV2ZWwvU2VydmljZS8xMjE4NjQ"
      + last_updated = (known after apply)
        name         = "mon_service"
      + tier_alias   = "tier_4"
        # (1 unchanged attribute hidden)
    }

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

Unset tier_alias, framework - set the lifecycle alias

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_service.mon_service will be updated in-place
  ~ resource "opslevel_service" "mon_service" {
      - framework       = "rails" -> null
        id              = "Z2lkOi8vb3BzbGV2ZWwvU2VydmljZS8xMjE4NjQ"
      + last_updated    = (known after apply)
      + lifecycle_alias = "pre-alpha"
        name            = "mon_service"
      - tier_alias      = "tier_4" -> null
        # (2 unchanged attributes hidden)
    }

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

Unset all fields except for name

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_service.mon_service will be updated in-place
  ~ resource "opslevel_service" "mon_service" {
      - description     = "hello world" -> null
        id              = "Z2lkOi8vb3BzbGV2ZWwvU2VydmljZS8xMjE4NjQ"
      + last_updated    = (known after apply)
      - lifecycle_alias = "pre-alpha" -> null
        name            = "mon_service"
      - owner           = "team_platform_3" -> null
    }

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

Destroy

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_service.mon_service will be destroyed
  - resource "opslevel_service" "mon_service" {
      - id   = "Z2lkOi8vb3BzbGV2ZWwvU2VydmljZS8xMjE4NjQ" -> null
      - name = "mon_service" -> null
    }

Plan: 0 to add, 0 to change, 1 to destroy.
opslevel_service.mon_service: Destroying... [id=Z2lkOi8vb3BzbGV2ZWwvU2VydmljZS8xMjE4NjQ]
opslevel_service.mon_service: Destruction complete after 1s