Vigiar
1
0
Derivar
Você já tinha feito uma derivação do repositório terraform-provider-mozoutmz, anteriormente
0
terraform-provider-mozoutmz/examples/complete/main.tf
2026-11-28 15:28:10 +02:00

54 linhas
1,1 KiB
HCL

# A site in one go: a VPS, a domain and the records that point the domain to the VPS.
# Run it first with a sandbox_ key: everything is simulated and nothing is charged.
terraform {
required_providers {
mozoutmz = {
source = "mozout-mz/mozoutmz"
version = "~> 1.0"
}
}
}
provider "mozoutmz" {}
variable "domain" {
type = string
default = "example.co.mz"
}
data "mozoutmz_catalog_products" "vps" {
kind = "vps"
}
resource "mozoutmz_vps" "web" {
product_id = data.mozoutmz_catalog_products.vps.products[0].id
billing_cycle = "monthly"
power_state = "running"
}
resource "mozoutmz_domain" "site" {
domain = var.domain
locked = true
auto_renew = true
}
resource "mozoutmz_dns_record" "root" {
domain = mozoutmz_domain.site.domain
name = "@"
type = "A"
value = coalesce(mozoutmz_vps.web.ip, "203.0.113.10")
ttl = 3600
}
resource "mozoutmz_dns_record" "www" {
domain = mozoutmz_domain.site.domain
name = "www"
type = "CNAME"
value = var.domain
ttl = 3600
}
output "server_ip" {
value = mozoutmz_vps.web.ip
}