infra/terraform/main.tf

94 lines
2 KiB
HCL

terraform {
required_providers {
dnsimple = {
source = "dnsimple/dnsimple"
version = "~> 2.0"
}
porkbun = {
source = "kyswtn/porkbun"
version = "~> 0.1"
}
powerdns = {
source = "pan-net/powerdns"
version = "~> 1.5"
}
vultr = {
source = "vultr/vultr"
version = "~> 2.28"
}
cloudflare = {
source = "cloudflare/cloudflare"
version = "~> 5.0"
}
# proxmox = {
# source = "bpg/proxmox"
# version = "~> 0.66"
# }
}
}
terraform {
backend "http" {
# Backend credentials should be set via environment variables:
# TF_HTTP_ADDRESS, TF_HTTP_LOCK_ADDRESS, TF_HTTP_UNLOCK_ADDRESS
# TF_HTTP_USERNAME, TF_HTTP_PASSWORD
}
}
provider "dnsimple" {
token = var.dnsimple_token
account = var.dnsimple_account
}
provider "porkbun" {
api_key = var.porkbun_api_key
secret_api_key = var.porkbun_secret_api_key
}
# provider "powerdns" {
# api_key = var.pdns_api_key
# server_url = var.pdns_server_url
# }
provider "cloudflare" {
# API token is read from CLOUDFLARE_API_TOKEN environment variable
# No explicit api_token parameter needed - provider automatically reads the env var
}
# provider "proxmox" {
# endpoint = var.proxmox_api_url
# username = var.proxmox_user
# password = var.proxmox_password
# insecure = var.proxmox_tls_insecure
# }
provider "powerdns" {
# alias = "vultr"
api_key = var.pdns_vultr_api_key
server_url = "http://100.93.123.98:8081"
}
variable "example_remote_state_address" {
type = string
description = "Gitlab remote state file address"
}
variable "example_username" {
type = string
description = "Gitlab username to query remote state"
}
variable "example_access_token" {
type = string
description = "GitLab access token to query remote state"
}
data "terraform_remote_state" "example" {
backend = "http"
config = {
address = var.example_remote_state_address
username = var.example_username
password = var.example_access_token
}
}