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

Updating betteruptime_status_page_resource fails #91

Closed
toha-nordic opened this issue Jun 6, 2024 · 2 comments · Fixed by #98
Closed

Updating betteruptime_status_page_resource fails #91

toha-nordic opened this issue Jun 6, 2024 · 2 comments · Fixed by #98

Comments

@toha-nordic
Copy link

toha-nordic commented Jun 6, 2024

I have successfully deployed a status page with a new Edge-based monitor of type v2:

resource "betteruptime_monitor" "CoapIpv4" {
  checks_version       = "v2"
  ip_version           = "ipv4"
  url                  = "coap.${var.host}"
  port                 = "5684"
  monitor_type         = "udp"
  monitor_group_id     = betteruptime_monitor_group.General.id
  ...
  regions              = ["us", "eu", "as", "au"]
}

resource "betteruptime_status_page_resource" "myOrgCoaP" {
  resource_type          = "Monitor"
  resource_id            = betteruptime_monitor.CoapIpv4.id
  ...
  widget_type            = "history"
  history                = true
}

Now Im trying to replace it with a similar, Proxy-based v1 monitor:

resource "betteruptime_monitor" "CoapIpv4Proxy" {
  checks_version       = "v1"
  url                  = "coap.${var.host}"
  port                 = "5684"
  monitor_type         = "udp"
  monitor_group_id     = betteruptime_monitor_group.General.id
  ...
  regions              = ["us", "eu", "as", "au"]
}

# Only resource_id changed:
resource "betteruptime_status_page_resource" "myOrgCoaP" {
  resource_type          = "Monitor"
  resource_id            = betteruptime_monitor.CoapIpv4Proxy.id
  ...
  widget_type            = "history"
  history                = true
}

terraform plan shows:

  # betteruptime_status_page_resource.myOrgCoaP will be updated in-place
  ~ resource "betteruptime_status_page_resource" "myOrgCoaP" {
        id                     = "8387136"
      ~ resource_id            = 1844499 -> 2275075
        # (10 unchanged attributes hidden)
    }

And terraform apply fails with:

betteruptime_status_page_resource.myOrgCoaP: Modifying... [id=8387136]
╷
│ Error: PATCH https://betteruptime.com/api/v2/status-pages/183276/resources/8387136 returned 422: {"errors":"Sorry, you are missing some required attributes","required_attributes":"resource_type"}
│ 
│   with betteruptime_status_page_resource.myOrgCoaP,
│   on status_pages_myorg.tf line 288, in resource "betteruptime_status_page_resource" "myOrgCoaP":
│  288: resource "betteruptime_status_page_resource" "myOrgCoaP" {

But the resource_type = "Monitor" is still there?

@PetrHeinz
Copy link
Contributor

PetrHeinz commented Jun 14, 2024

Hello @toha-nordic, thanks for the report!

We've managed to find the issue, and fix in the v0.10.2 release 🙌

Running terraform init --upgrade before the next apply should ensure the resource gets updated correctly 🚀

@toha-nordic
Copy link
Author

Thank you, seems to work for me now 👍

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 a pull request may close this issue.

2 participants