Archived
Improve local dev override docs and add read-only example
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
# Lists all Dynu domains available to the configured API key.
|
||||
data "dynu_domains" "all" {}
|
||||
|
||||
# Resolves the Dynu root domain for a specific hostname.
|
||||
data "dynu_domain" "selected" {
|
||||
hostname = var.hostname
|
||||
}
|
||||
|
||||
# Lists DNS records for the root domain resolved from the same hostname.
|
||||
data "dynu_dns_records" "selected" {
|
||||
hostname = var.hostname
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
output "domains" {
|
||||
description = "All visible Dynu domains."
|
||||
value = data.dynu_domains.all.domains
|
||||
}
|
||||
|
||||
output "resolved_domain" {
|
||||
description = "Resolved Dynu root domain details for var.hostname."
|
||||
value = data.dynu_domain.selected.domain
|
||||
}
|
||||
|
||||
output "resolved_dns_records" {
|
||||
description = "DNS records for the resolved root domain."
|
||||
value = data.dynu_dns_records.selected.records
|
||||
}
|
||||
|
||||
output "resolved_domain_id" {
|
||||
description = "Domain ID returned by dynu_dns_records."
|
||||
value = data.dynu_dns_records.selected.domain_id
|
||||
}
|
||||
|
||||
output "resolved_domain_name" {
|
||||
description = "Root domain name returned by dynu_dns_records."
|
||||
value = data.dynu_dns_records.selected.domain_name
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
terraform {
|
||||
required_version = ">= 1.5.0"
|
||||
|
||||
required_providers {
|
||||
dynu = {
|
||||
source = "dynu/dynu"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Local development note:
|
||||
# This source address stays "dynu/dynu" while using ~/.terraformrc dev_overrides.
|
||||
# Terraform will load your local terraform-provider-dynu binary instead of the public registry.
|
||||
provider "dynu" {
|
||||
# Use DYNU_API_KEY environment variable by default.
|
||||
# Set var.dynu_api_key in terraform.tfvars to override.
|
||||
api_key = var.dynu_api_key
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
# Copy to terraform.tfvars and adjust values for your environment.
|
||||
# dynu_api_key can be omitted when DYNU_API_KEY is exported in your shell.
|
||||
# dynu_api_key = "replace-with-dynu-api-key"
|
||||
|
||||
# Use a hostname that exists in your Dynu account.
|
||||
hostname = "www.example.com"
|
||||
@@ -0,0 +1,12 @@
|
||||
variable "dynu_api_key" {
|
||||
description = "Dynu API key. Leave null to use DYNU_API_KEY from environment."
|
||||
type = string
|
||||
default = null
|
||||
sensitive = true
|
||||
}
|
||||
|
||||
variable "hostname" {
|
||||
description = "Fully-qualified hostname used by dynu_domain and dynu_dns_records data sources."
|
||||
type = string
|
||||
default = "www.example.com"
|
||||
}
|
||||
Reference in New Issue
Block a user