I use a module for DNS entries so I can provide the same values to multiple name servers:
# dns.tf
provider "dnsimple" {
account "MyCompany"
version = "~> 0.2.0"
}
module "dns_foo" {
name = "foo.mycompany.com"
type = "CNAME"
value = "foo.origins.mycompany.com"
source = "./modules/dns-entry"
}
# modules/dns-entry/variables.tf
variable "name" {}
variable "type" {
type = string
}
variable "value" {
type = string
}
# modules/dns-entry/main.tf
resource "dnsimple_record" "this" {
domain = var.name
name = var.name
ttl = 60
type = var.type
value = var.value
}
resource "another_nameserver_record" "this" {
…
}
Expected Behavior
The account attribute of the top-level dnsimple provider should carry through to the module.
Actual Behavior
Terraform emits this error:
Error: Missing required attribute
on <input-prompt> line 1:
(source code not available)
The attribute "account" is required, but no definition was found.
Steps to Reproduce
declare a dnsimple provider at the top-level; include the account attribute
declare a dnsimple_record resource in a module
run terraform plan
Important Factoids
I don't experience this problem with provider.aws.region. I also use AWS resources in modules and declare the provider and some default attributes at the top-level.
If I remove account = "My Company" from the provider block, then terraform plan prompts me for it and it works.
The problem also goes away if I set the DNSIMPLE_ACCOUNT environment variable.
Terraform Version
v0.12.6
Affected Resource(s)
provider.dnsimple
Terraform Configuration Files
I use a module for DNS entries so I can provide the same values to multiple name servers:
Expected Behavior
The
account
attribute of the top-leveldnsimple
provider should carry through to the module.Actual Behavior
Terraform emits this error:
Steps to Reproduce
dnsimple
provider at the top-level; include theaccount
attributednsimple_record
resource in a moduleterraform plan
Important Factoids
I don't experience this problem with
provider.aws.region
. I also use AWS resources in modules and declare the provider and some default attributes at the top-level.If I remove
account = "My Company"
from theprovider
block, thenterraform plan
prompts me for it and it works.The problem also goes away if I set the
DNSIMPLE_ACCOUNT
environment variable.References
The modules docs describe how