BetterStackHQ / terraform-provider-better-uptime

Apache License 2.0
45 stars 12 forks source link

resource group doesn't exits #68

Open Ashutoshkale opened 5 months ago

Ashutoshkale commented 5 months ago

I'm trying to create monitor with following provider

required_providers {
    betteruptime = {
      source = "BetterStackHQ/better-uptime"
      version = "0.5.1"
    }

terraform version

Terraform v1.7.1
on linux_amd64

error

POST https://betteruptime.com/api/v2/monitors returned 422: {"errors":{"resource_group":["doesn't exist"]}}

resource "betteruptime_monitor" "xx-xx" {

}
PetrHeinz commented 1 month ago

Hello @Ashutoshkale, apologies for the late reaction 🙌

I've tried to recreate you config (better-uptime provider in v0.5.1, using a slightly higher version of TF v1.8.0):

terraform {
  required_version = ">= 0.13"
  required_providers {
    betteruptime = {
      source  = "BetterStackHQ/better-uptime"
      version = "0.5.1"
    }
  }
}

resource "betteruptime_monitor" "xx-xx" {

}

With this config BETTERUPTIME_API_TOKEN=XXX terraform apply fails on missing required arguments:

â•·
│ Error: Missing required argument
│ 
│   on main.tf line 11, in resource "betteruptime_monitor" "xx-xx":
│   11: resource "betteruptime_monitor" "xx-xx" {
│ 
│ The argument "monitor_type" is required, but no definition was found.
╵
â•·
│ Error: Missing required argument
│ 
│   on main.tf line 11, in resource "betteruptime_monitor" "xx-xx":
│   11: resource "betteruptime_monitor" "xx-xx" {
│ 
│ The argument "url" is required, but no definition was found.
╵

I've added the required arguments:

terraform {
  required_version = ">= 0.13"
  required_providers {
    betteruptime = {
      source  = "BetterStackHQ/better-uptime"
      version = "0.5.1"
    }
  }
}

resource "betteruptime_monitor" "xx-xx" {
  url          = "https://example.com"
  monitor_type = "status"
}

Now, BETTERUPTIME_API_TOKEN=XXX terraform apply succeeded:

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:

  # betteruptime_monitor.xx-xx will be created
  + resource "betteruptime_monitor" "xx-xx" {
      + check_frequency  = 180
      + created_at       = (known after apply)
      + email            = true
      + follow_redirects = true
      + http_method      = "GET"
      + id               = (known after apply)
      + last_checked_at  = (known after apply)
      + monitor_type     = "status"
      + paused_at        = (known after apply)
      + push             = true
      + recovery_period  = 180
      + remember_cookies = true
      + request_timeout  = 30
      + status           = (known after apply)
      + updated_at       = (known after apply)
      + url              = "https://example.com"
      + verify_ssl       = true
    }

Plan: 1 to add, 0 to change, 0 to destroy.
betteruptime_monitor.xx-xx: Creating...
betteruptime_monitor.xx-xx: Creation complete after 1s [id=2320154]

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

Are you still encountering the issue? Maybe you've omitted part of your configuration which is the reason behind the issue you're mentioning.

Also, I'd recommend to upgrade our provider to v0.10.0 or higher, as there were a few fixes, tweaks and new features added since than 🙌