Skip to content

Instantly share code, notes, and snippets.

@mattmichal
mattmichal / main.tf
Created October 7, 2022 11:31
Sample Terraform code that uses Cloudflare provider version 3.25.0 to perform operations on resources that require API token as well as API user service key. Secrets are passed to Terraform via TF_VAR environment variables. Two providers are configured and then both are passed to a local module.
module "app" {
for_each = local.applications.customers
source = "./modules/app/"
customer_name = each.key
providers = {
cloudflare = cloudflare
cloudflare.user_service_key = cloudflare.user_service_key
}
}
[CmdletBinding()]
Param(
[Parameter(Mandatory=$true)]
[string] $hostname,
[Parameter(Mandatory=$true)]
[string] $username,
[Parameter(Mandatory=$true)]
[string] $password,
[Parameter(Mandatory=$true)]
[string] $sourcedirectory,