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

Add new resource "uptimerobot_alert_contact_assignment" #12

Open
c33s opened this issue Oct 31, 2022 · 1 comment
Open

Add new resource "uptimerobot_alert_contact_assignment" #12

c33s opened this issue Oct 31, 2022 · 1 comment

Comments

@c33s
Copy link

c33s commented Oct 31, 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 louy#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"]
}

related issues:

louy#116
vexxhost#11

@yktakaha4
Copy link

This is a backward incompatible change, but I prefer it this way too.
I would like to specify Deprecated to alert_contact attribute.
https://developer.hashicorp.com/terraform/plugin/sdkv2/best-practices/deprecations

Could you please create a PR?

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

No branches or pull requests

2 participants