Giter Site home page Giter Site logo

terraform-provider-uptimerobot's Introduction

Terraform UptimeRobot Provider

Build Status

Getting started

To install this provider, check out the installation instructions on Terraform's registry page.

terraform {
  required_providers {
    uptimerobot = {
      source = "mindee/uptimerobot"
      version = "1.0.0"
    }
  }
}

provider "uptimerobot" {
  api_key = "[YOUR MAIN API KEY]" # or pass via environment variable UPTIMEROBOT_API_KEY
}

data "uptimerobot_account" "account" {}

data "uptimerobot_alert_contact" "default_alert_contact" {
  friendly_name = data.uptimerobot_account.account.email
}

resource "uptimerobot_alert_contact" "slack" {
  friendly_name = "Slack Alert"
  type          = "slack"
  value         = "https://hooks.slack.com/services/XXXXXXX"
}

resource "uptimerobot_monitor" "main" {
  friendly_name = "My Monitor"
  type          = "http"
  url           = "http://example.com"
  # pro allows 60 seconds
  interval      = 300

  alert_contact {
    id = uptimerobot_alert_contact.slack.id
    # threshold  = 0  # pro only
    # recurrence = 0  # pro only
  }

  alert_contact {
    id = data.uptimerobot_alert_contact.default_alert_contact.id
  }
}

resource "uptimerobot_monitor" "custom_port" {
  url           = "doe.john.me"
  type          = "port"
  sub_type      = "custom"
  port          = 5678
  friendly_name = "Custom port"
}

resource "uptimerobot_status_page" "main" {
  friendly_name  = "My Status Page"
  custom_domain  = "status.example.com"
  password       = "WeAreAwsome"
  sort           = "down-up-paused"
  monitors       = [uptimerobot_monitor.main.id]
}

resource "aws_route53_record" {
  zone_id = "[MY ZONE ID]"
  type    = "CNAME"
  records = [uptimerobot_status_page.main.dns_address]
}

terraform-provider-uptimerobot's People

Contributors

louy avatar allcontributors[bot] avatar drubin avatar paretl avatar nlamirault avatar caarlos0 avatar jjungnickel avatar mtanda avatar sokratisg avatar nhamlh avatar yifan610 avatar randrusiak avatar leeif avatar novex avatar piotrgiedziun avatar kokarn avatar invidian avatar manuelvanrijn avatar solarkennedy avatar kevincali avatar jasonrogena avatar ad-m avatar

Stargazers

Noel Light-Hilary avatar  avatar  avatar  avatar Vincent Legout avatar  avatar

Watchers

Vincent Legout avatar  avatar

terraform-provider-uptimerobot's Issues

Alert Contacts constantly changing, seeing the current contact as the first contact from getAlertContacts

I think there has been a change in the UptimeRobot API recently, whenever I plan, any uptimerobot_alert_contact shows it needs to be replaced, showing the existing id matching the correct contact but the friendly name and type showing the first contact returned by the getAlertContacts

I recreated this with a very basic setup

terraform {
  required_version = "1.8.5"

  required_providers {
    uptimerobot = {
      source  = "mindee/uptimerobot"
      version = "1.1.2"
    }
  }
}

provider "uptimerobot" {}

resource "uptimerobot_alert_contact" "webhook_website" {
  friendly_name = "Webhook - Website"
  type          = "webhook"
  value         = "https://example.com"
}

the plan was as expected

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:

  # uptimerobot_alert_contact.webhook_website will be created
  + resource "uptimerobot_alert_contact" "webhook_website" {
      + friendly_name = "Webhook - Website"
      + id            = (known after apply)
      + status        = (known after apply)
      + type          = "webhook"
      + value         = "https://example.com"
    }

Plan: 1 to add, 0 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

uptimerobot_alert_contact.webhook_website: Creating...
uptimerobot_alert_contact.webhook_website: Creation complete after 1s [id=6520503]

I then run plan again and get the following

Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
-/+ destroy and then create replacement

Terraform will perform the following actions:

  # uptimerobot_alert_contact.webhook_website must be replaced
-/+ resource "uptimerobot_alert_contact" "webhook_website" {
      ~ friendly_name = "lorenzo - e-mail" -> "Webhook - Website"
      ~ id            = "6520503" -> (known after apply)
      ~ status        = "active" -> (known after apply)
      ~ type          = "email" -> "webhook" # forces replacement
      ~ value         = "[email protected]" -> "https://example.com" # forces replacement
    }

Plan: 1 to add, 0 to change, 1 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: 

Add support for windows_amd64

Provider registry.terraform.io/mindee/uptimerobot v1.0.0 does not have a package available for your current platform, windows_amd64.

Import existing resources into Terraform's state

Would you mind updating documentation showcasing how one could import existing UptimeRobot resources into Terraform's state with terraform import?

E.g.:

terraform import uptimerobot_monitor.example 123456789

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.