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

use new String type that matches GraphQL API #330

Closed davidbloss closed 4 months ago

davidbloss commented 4 months ago

Issues

fix unsetting Service lifecycleAlias and tierAlias fields

Changelog

Use downstream String scalar that matches our GraphQL API. See opslevel-go PR ⚠️ Depends on this opslevel-go PR being merged first.

Tophatting

With this config

resource "opslevel_service" "test" {
  api_document_path             = "my/path/doc.yaml"
  description                   = "fancy things"
  framework                     = "da-best"
  language                      = "go"
  lifecycle_alias               = "alpha"
  name                          = "tophatting-service"
  owner                         = "platform"
  preferred_api_document_source = "PUSH"
  product                       = "tophat"
  tags                          = ["key:value"]
  tier_alias                    = "tier_2"
}

Create service with tierAlias and lifecycleAlias fields defined. Run 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:

  # opslevel_service.test will be created
  + resource "opslevel_service" "test" {
      + api_document_path             = "my/path/doc.yaml"
      + description                   = "fancy things"
      + framework                     = "da-best"
      + id                            = (known after apply)
      + language                      = "go"
      + last_updated                  = (known after apply)
      + lifecycle_alias               = "alpha"
      + name                          = "tophatting-service"
      + owner                         = "platform"
      + preferred_api_document_source = "PUSH"
      + product                       = "tophat"
      + tags                          = [
          + "key:value",
        ]
      + tier_alias                    = "tier_2"
    }

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

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

Unset lifecycle_alias and tier_alias fields

resource "opslevel_service" "test" {
  api_document_path             = "my/path/doc.yaml"
  description                   = "fancy things"
  framework                     = "da-best"
  language                      = "go"
  # lifecycle_alias               = "alpha"
  name                          = "tophatting-service"
  owner                         = "platform"
  preferred_api_document_source = "PUSH"
  product                       = "tophat"
  tags                          = ["key:value"]
  # tier_alias                    = "tier_2"
}

Update service, setting tierAlias and lifecycleAlias fields to null. Run terraform apply

opslevel_service.test: Refreshing state... [id=Z2lkOi8vb3BzbGV2ZWwvU2VydmljZS8xMjE4MjM]

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.test will be updated in-place
  ~ resource "opslevel_service" "test" {
        id                            = "Z2lkOi8vb3BzbGV2ZWwvU2VydmljZS8xMjE4MjM"
      + last_updated                  = (known after apply)
      - lifecycle_alias               = "alpha" -> null
        name                          = "tophatting-service"
        tags                          = [
            "key:value",
        ]
      - tier_alias                    = "tier_2" -> null
        # (7 unchanged attributes hidden)
    }

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

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

Destroy service, task destroy

opslevel_service.test: Refreshing state... [id=Z2lkOi8vb3BzbGV2ZWwvU2VydmljZS8xMjE4MjM]

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.test will be destroyed
  - resource "opslevel_service" "test" {
      - api_document_path             = "my/path/doc.yaml" -> null
      - description                   = "fancy things" -> null
      - framework                     = "da-best" -> null
      - id                            = "Z2lkOi8vb3BzbGV2ZWwvU2VydmljZS8xMjE4MjM" -> null
      - language                      = "go" -> null
      - name                          = "tophatting-service" -> null
      - owner                         = "platform" -> null
      - preferred_api_document_source = "PUSH" -> null
      - product                       = "tophat" -> null
      - tags                          = [
          - "key:value",
        ] -> null
    }

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

Destroy complete! Resources: 1 destroyed.