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 `file_contents_predicate` for `opslevel_check_repository_grep` by making it required #335

Closed taimoorgit closed 4 months ago

taimoorgit commented 4 months ago

Issues

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

^ While the ticket says to use a pointer so that you can OPTIONALLY use the FileContentsPredicate, I don't think that this is a good idea because it is a required field in the API.

Pic 1: create input for the check resource, pic 2: the resource

image image

Changelog

Tophatting

Can create

Terraform will perform the following actions:

  # opslevel_check_repository_grep.grep will be created
  + resource "opslevel_check_repository_grep" "grep" {
      + category                = "Z2lkOi8vb3BzbGV2ZWwvQ2F0ZWdvcnkvNjk3OA"
      + description             = (known after apply)
      + directory_search        = false
      + enabled                 = false
      + file_contents_predicate = {
          + type = "exists"
        }
      + filepaths               = [
          + "src/main.go",
        ]
      + id                      = (known after apply)
      + last_updated            = (known after apply)
      + level                   = "Z2lkOi8vb3BzbGV2ZWwvTGV2ZWwvMzcxMA"
      + name                    = "Hello World Repo Grep"
    }

Plan: 1 to add, 0 to change, 0 to destroy.
opslevel_check_repository_grep.grep: Creating...
opslevel_check_repository_grep.grep: Creation complete after 0s [id=Z2lkOi8vb3BzbGV2ZWwvQ2hlY2tzOjpSZXBvR3JlcC8yNDc5Nw]

Can update

Terraform will perform the following actions:

  # opslevel_check_repository_grep.grep will be updated in-place
  ~ resource "opslevel_check_repository_grep" "grep" {
      ~ description             = "Verifies the existence and/or contents of files in a service's attached Git repositories." -> (known after apply)
        id                      = "Z2lkOi8vb3BzbGV2ZWwvQ2hlY2tzOjpSZXBvR3JlcC8yNDc5Nw"
      + last_updated            = (known after apply)
      ~ level                   = "Z2lkOi8vb3BzbGV2ZWwvTGV2ZWwvMzcxMA" -> "Z2lkOi8vb3BzbGV2ZWwvTGV2ZWwvMzcwOA"
        name                    = "Hello World Repo Grep"
        # (5 unchanged attributes hidden)
    }

Plan: 0 to add, 1 to change, 0 to destroy.
opslevel_check_repository_grep.grep: Modifying... [id=Z2lkOi8vb3BzbGV2ZWwvQ2hlY2tzOjpSZXBvR3JlcC8yNDc5Nw]
opslevel_check_repository_grep.grep: Modifications complete after 1s [id=Z2lkOi8vb3BzbGV2ZWwvQ2hlY2tzOjpSZXBvR3JlcC8yNDc5Nw]

Can delete

  # opslevel_check_repository_grep.grep will be destroyed
  - resource "opslevel_check_repository_grep" "grep" {
      - category                = "Z2lkOi8vb3BzbGV2ZWwvQ2F0ZWdvcnkvNjk3OA" -> null
      - description             = "Verifies the existence and/or contents of files in a service's attached Git repositories." -> null
      - directory_search        = false -> null
      - enabled                 = false -> null
      - file_contents_predicate = {
          - type = "exists" -> null
        } -> null
      - filepaths               = [
          - "src/main.go",
        ] -> null
      - id                      = "Z2lkOi8vb3BzbGV2ZWwvQ2hlY2tzOjpSZXBvR3JlcC8yNDc5Nw" -> null
      - level                   = "Z2lkOi8vb3BzbGV2ZWwvTGV2ZWwvMzcwOA" -> null
      - name                    = "Hello World Repo Grep" -> null
    }

Plan: 0 to add, 0 to change, 1 to destroy.
opslevel_check_repository_grep.grep: Destroying... [id=Z2lkOi8vb3BzbGV2ZWwvQ2hlY2tzOjpSZXBvR3JlcC8yNDc5Nw]
opslevel_check_repository_grep.grep: Destruction complete after 0s