Skip to content

Provider configuration doesn't respect datasources #127

@petrmvala

Description

@petrmvala

Hi there,

the hashicorp/dns provider seems to have problems when destroying resources while the provider variables are dependent on other resources. In this example, I am showing that empty terraform state produces provider configuration error on terraform destroy. There are no problems observed when creating or altering resources. Let me know if I can help some more in pinning this down.

Terraform Version

$ terraform -v
Terraform v0.14.7

  • provider registry.terraform.io/hashicorp/aws v3.30.0
  • provider registry.terraform.io/hashicorp/dns v3.1.0

Affected Resource(s)

hashicorp/dns

Terraform Configuration Files

provider "aws" {
  region = "us-east-1"
}

provider "dns" {
  update {
    server        = "my-nameserver"
    key_algorithm = "hmac-sha512"
    key_name      = "my-dns-zone."
    key_secret    = jsondecode(data.aws_secretsmanager_secret_version.dns.secret_string)["key"]
  }
}

data "aws_secretsmanager_secret_version" "dns" {
  secret_id = "my-dns-zone."
}

resource "dns_a_record_set" "foo" {
  zone      = "my-dns-zone."
  name      = "foo"
  addresses = ["xx.xx.xx.xx"]
  ttl       = 300
}

Debug Output

https://gist.github.com/petrmvala/a98a6cfff0097dbe65275a9e1e401413

Panic Output

No

Expected Behavior

No errors

Actual Behavior

Error: Error configuring provider: when using authentication, "key_name", "key_secret" and "key_algorithm" should be non empty

Steps to Reproduce

terraform destroy

Important Factoids

None

References

None that I know of

Also, don't "panic:". Sorry, I had to. :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions