Code Monkey home page Code Monkey logo

Comments (11)

hydrapolic avatar hydrapolic commented on August 11, 2024 2

@adikus works like a charm, thanks!

from terraform-provider-better-uptime.

hydrapolic avatar hydrapolic commented on August 11, 2024

This was added in ce3496b

However if configured, terraform wants to update in-place the resource each time it's run even if there is no change.

from terraform-provider-better-uptime.

adikus avatar adikus commented on August 11, 2024

Closing this, as the issues with expected_status_code should be now fixed on the API side.

from terraform-provider-better-uptime.

hydrapolic avatar hydrapolic commented on August 11, 2024

@adikus, just tested and still the same issue.

from terraform-provider-better-uptime.

adikus avatar adikus commented on August 11, 2024

@hydrapolic which version of the plugin are you using? I just tested this with the latest one, and creating / updating a monitor with an expected_status_code worked as I would expect.

If you're on the latest version (0.3.8), could you please share your terraform config at [email protected] so that we can have a look?

from terraform-provider-better-uptime.

hydrapolic avatar hydrapolic commented on August 11, 2024

@adikus I'm using version 0.3.8.

When issuing terraform plan, it's stated that the monitors will be updated in place. Of course there's nothing wrong with it, but in fact the value of expected_status_codes haven't changed at all so it should state "no change".

from terraform-provider-better-uptime.

hydrapolic avatar hydrapolic commented on August 11, 2024

Just checked the output again. It seems like it only happens for monitors that had expected_status_codes defined previously but then we turned it off (for example we started monitoring a service that returned 404 for url /, but later it was changed to 200 so expected_status_codes was unnecessary).

from terraform-provider-better-uptime.

hydrapolic avatar hydrapolic commented on August 11, 2024

How to reproduce:

  1. set up a monitor with monitor_type = expected_status_code and fill in expected_status_codes (for example 200/404)
  2. change monitor_type to status
# terraform apply
  # monitor will be updated in-place
  ~ resource "betteruptime_monitor" "monitor" {
      ~ expected_status_codes = [
          - 200,
          - 404,
        ]
      ~ monitor_type          = "expected_status_code" -> "status"
terraform apply
  # monitor.monitor will be updated in-place
  ~ resource "betteruptime_monitor" "monitor" {
      ~ expected_status_codes = [
          - 200,
          - 404,
        ]
        # (21 unchanged attributes hidden)
    }

from terraform-provider-better-uptime.

adikus avatar adikus commented on August 11, 2024

@hydrapolic Thanks for the instructions on how to reproduce. Looks like we're not allowing for the expected status codes to be unset once they've been set. I'll have a look into that.

In the meantime it sounds like the workaround, if I can call it that, is to keep some status code in there (e.g. [200]), even if it's not going to be used.

from terraform-provider-better-uptime.

hydrapolic avatar hydrapolic commented on August 11, 2024

An alternative to that is to ignore changes in expected_status_codes once they are applied:

lifecycle {
  ignore_changes = [
    expected_status_codes
   ]
}

from terraform-provider-better-uptime.

adikus avatar adikus commented on August 11, 2024

@hydrapolic We rolled out a change to the API, so when you completely remove expected_status_codes it will get correctly propagated.

from terraform-provider-better-uptime.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.