Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug with tls_skip_verify not being type casted correctly #146

Merged
merged 1 commit into from
Feb 23, 2021

Conversation

zahiar
Copy link
Contributor

@zahiar zahiar commented Feb 6, 2021

The API expects this value to be of type boolean, anything else including the string variant "true" is rejected.

{
    "message": "monitoring job config error: \"true\" invalid for option \"tls_skip_verify\""
}

Tested locally

resource "ns1_monitoringjob" "test" {
  name            = "ZA TEST"
  active          = true

  frequency = 30
  job_type = "http"
  regions = ["sin", "sjc", "lga", "ams", "syd"]

  config = {
    tls_skip_verify = true
    authorization   = null
    connect_timeout = 5
    idle_timeout    = 3
    method          = "GET"
    url             = "http://localhost"
  }

  rules {
    key        = "status_code"
    comparison = "=="
    value      = "200"
  }
}

Plan

Terraform will perform the following actions:

  # ns1_monitoringjob.test will be created
  + resource "ns1_monitoringjob" "test" {
      + active        = true
      + config        = {
          + "connect_timeout" = "5"
          + "idle_timeout"    = "3"
          + "method"          = "GET"
          + "tls_skip_verify" = "true"
          + "url"             = "http://localhost"
        }
      + frequency     = 30
      + id            = (known after apply)
      + job_type      = "http"
      + name          = "ZA TEST"
      + policy        = "quorum"
      + rapid_recheck = false
      + regions       = [
          + "sin",
          + "sjc",
          + "lga",
          + "ams",
          + "syd",
        ]

      + rules {
          + comparison = "=="
          + key        = "status_code"
          + value      = "200"
        }
    }

Plan: 1 to add, 0 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

ns1_monitoringjob.test: Creating...
ns1_monitoringjob.test: Creation complete after 3s [id=601df78bdadd4800b1d43c21]

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

I then changed tls_skip_verify = true to tls_skip_verify = false, to ensure it was able to update it without issue.

An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  # ns1_monitoringjob.test will be updated in-place
  ~ resource "ns1_monitoringjob" "test" {
      ~ config          = {
          ~ "tls_skip_verify" = "true" -> "false"
            # (4 unchanged elements hidden)
        }
        id              = "601df78bdadd4800b1d43c21"
        name            = "ZA TEST"
        # (10 unchanged attributes hidden)

        # (1 unchanged block hidden)
    }

Plan: 0 to add, 1 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

ns1_monitoringjob.test: Modifying... [id=601df78bdadd4800b1d43c21]
ns1_monitoringjob.test: Modifications complete after 2s [id=601df78bdadd4800b1d43c21]

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

The API expects this value to be of type boolean, anything other include the string variant "true" is rejected.
```
{
    "message": "monitoring job config error: \"true\" invalid for option \"tls_skip_verify\""
}
```
@zahiar
Copy link
Contributor Author

zahiar commented Feb 9, 2021

@cpg1111 Thanks for the approval 🙏

Do you have an ETA as to when the next release will be, a tad keen to start making use of this in our projects 😄

@mburtless mburtless merged commit c20d64a into ns1-terraform:master Feb 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants