The Terraform DNSimple provider allows you to manage DNSimple resources using Terraform.
The provider is available on the Terraform Registry. Add the following to your Terraform configuration:
terraform {
required_providers {
dnsimple = {
source = "dnsimple/dnsimple"
version = "~> 1.0"
}
}
}
provider "dnsimple" {
token = var.dnsimple_token
account = var.dnsimple_account
sandbox = true # Set to false for production
}Then run:
terraform initFull documentation is available on the Terraform Registry.
After installing the provider, configure it with your DNSimple credentials:
provider "dnsimple" {
token = "your-api-token"
account = "your-account-id"
sandbox = true
}
resource "dnsimple_zone" "example" {
name = "example.com"
}
resource "dnsimple_zone_record" "www" {
zone_id = dnsimple_zone.example.id
name = "www"
type = "A"
value = "1.2.3.4"
}Clone the repository:
git clone git@github.com:dnsimple/terraform-provider-dnsimple.git
cd terraform-provider-dnsimpleBuild the provider:
make buildThis will build the provider and place the binary in $GOPATH/bin.
Run the unit tests:
make testRun the acceptance tests (requires DNSimple API credentials):
DNSIMPLE_ACCOUNT=12345 DNSIMPLE_TOKEN="your-token" DNSIMPLE_DOMAIN=example.com DNSIMPLE_SANDBOX=true make testaccNote: Acceptance tests create real resources and may incur costs.
The sandbox environment does not support certificate operations. To test dnsimple_lets_encrypt_certificate resources, run tests in production:
DNSIMPLE_SANDBOX=false DNSIMPLE_CERTIFICATE_NAME=www DNSIMPLE_CERTIFICATE_ID=123 make testaccTo use a locally built version of the provider:
-
Install the provider:
make install
-
Create a symlink to the Terraform plugins directory:
# Replace darwin_arm64 with your architecture mkdir -p ~/.terraform.d/plugins/terraform.local/dnsimple/dnsimple/0.1.0/darwin_arm64 ln -s "$GOBIN/terraform-provider-dnsimple" ~/.terraform.d/plugins/terraform.local/dnsimple/dnsimple/0.1.0/darwin_arm64/
-
Configure Terraform to use the local provider:
terraform { required_providers { dnsimple = { source = "terraform.local/dnsimple/dnsimple" version = "0.1.0" } } }
-
Test with the example configuration:
cd example terraform init && terraform apply
We welcome contributions! Please see CONTRIBUTING.md for guidelines on how to contribute to this project.
This project is licensed under the Mozilla Public License 2.0. See LICENSE for details.