Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

Add new resource "uptimerobot_alert_contact_assignment" #116

Open
c33s opened this issue Jan 18, 2022 · 0 comments
Open

Add new resource "uptimerobot_alert_contact_assignment" #116

c33s opened this issue Jan 18, 2022 · 0 comments

Comments

@c33s
Copy link

c33s commented Jan 18, 2022

currently the mapping of an alert_contact to a monitor is a little bit unhandy as it is defined inside of the monitor. this leads also to problems like #97 (comment)

my suggestion would be to add a separate resource "uptimerobot_alert_contact_assignment" which would also allow the easy use of the terraform each functionality.

this would be like the hetzner hcloud network resources:
https://registry.terraform.io/providers/hetznercloud/hcloud/latest/docs/resources/server_network

resource "hcloud_server" "node1" {
  name        = "node1"
  image       = "debian-9"
  server_type = "cx11"
}
resource "hcloud_network" "mynet" {
  name     = "my-net"
  ip_range = "10.0.0.0/8"
}
resource "hcloud_network_subnet" "foonet" {
  network_id   = hcloud_network.mynet.id
  type         = "cloud"
  network_zone = "eu-central"
  ip_range     = "10.0.1.0/24"
}

resource "hcloud_server_network" "srvnetwork" {
  server_id  = hcloud_server.node1.id
  network_id = hcloud_network.mynet.id
  ip         = "10.0.1.5"
}

from:

resource "uptimerobot_monitor" "my_monitor" {
  ...
  alert_contact {
    id = resource.uptimerobot_alert_contact.email_alerts["NameOfContact1"].id
  }
  alert_contact {
    id = resource.uptimerobot_alert_contact.email_alerts["NameOfContact2"].id
  }
  ...
}

to

resource "uptimerobot_monitor" "my_monitor" {
  ...
}

resource "uptimerobot_alert_contact_assignment" "all_email_contacts" {
  for_each = resource.uptimerobot_alert_contact.email_alerts
  monitor_id: resource .uptimerobot_monitor.my_monitor.id
  alert_id: each.value["id"]
}
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant