-
-
Save dakota-marshall/657c7f2ea36491a39f733a02039fce53 to your computer and use it in GitHub Desktop.
icinga2-terraform example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
terraform { | |
required_providers { | |
icinga2 = { | |
source = "Icinga/icinga2" | |
version = "0.5.0" | |
} | |
} | |
} | |
## Providers | |
provider "icinga2" { | |
api_url = "https://myapiurl" | |
api_user = var.icinga_user | |
api_password = var.icinga_password | |
insecure_skip_tls_verify = true | |
} | |
## Inputs | |
variable "icinga_user" {} | |
variable "icinga_password" { | |
sensitive = true | |
} | |
variable "os" { | |
default = "linux" | |
} | |
variable "specialty" { | |
default = "linux" | |
} | |
variable "department" { | |
default = "cts" | |
} | |
variable "priority" { | |
default = ["normal"] | |
} | |
variable "level" { | |
default = 2 | |
} | |
variable "ssl_uris" { | |
default = [""] | |
} | |
variable "roles" { | |
default = [""] | |
} | |
variable "checks" { | |
default = [""] | |
} | |
variable "disabled_checks" { | |
default = [""] | |
} | |
variable "httpurl" { | |
default = "" | |
} | |
variable "host_ip" {} | |
variable "host_name" {} | |
variable "automation_groups" { | |
description = "List of hostgroups the host belongs to." | |
default = [] | |
} | |
resource "icinga2_host" "host-object" { | |
hostname = var.host_name | |
address = var.host_ip | |
templates = ["my-host-template"] | |
check_command = "hostalive" | |
vars = { | |
os = var.os | |
specialty = var.specialty | |
department = var.department | |
priority = var.priority | |
level = var.level | |
automation_groups = var.automation_groups | |
ssl_uris = var.ssl_uris | |
roles = var.roles | |
checks = var.checks | |
disabled_checks = var.disabled_checks | |
httpurl = var.httpurl | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment