You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Terraform v1.1.9
on darwin_amd64
+ provider registry.terraform.io/hashicorp/dns v3.2.3
Terraform Configuration
terraform {
required_version=">= 1.1.9"required_providers {
dns={
source ="hashicorp/dns"
version ="3.2.3"
}
}
}
variable"zone" {
type=stringdefault="<zone>"
}
variable"ttl" {
type=numberdefault=60
}
provider"dns" {
update {
server="<server>"gssapi {
realm="<REALM>"username="<username>"password="<password>"
}
}
}
# This causes a crashresource"dns_txt_record_set""test1" {
zone=var.zonename="This is a test"txt=["Hello World"]
ttl=var.ttl
}
# This causes a crashresource"dns_ptr_record""test2" {
zone=var.zonename="test._dns-sd._udp"ptr="Hello World.${var.zone}"ttl=var.ttl
}
# This correctly applies but falsely causes errors on subsequent runsresource"dns_ptr_record""test3" {
zone=var.zonename="test._dns-sd._udp"ptr="Hello\\ World.${var.zone}"ttl=var.ttl
}
Expected Behavior
I expect the DNS provider to automatically escape special characters in record names and in all places that reference record names. I expect the provided example configuration to be applied successfully.
Actual Behavior
Terraform crashes during the apply command.
Steps to Reproduce
In the provided configuration substitute appropriate values for <zone>, <server>, <REALM>, <username>, and <password>. I suspect that the issue also occurs when using keys for authentication, but I did not test that.
Run terraform apply
The plan succeeds. Type yes and hit enter
Terraform crashes while trying to apply the configuration
Unescaped spaces in record names (or record values referencing record names) cause a plugin crash
Escaped spaces in PTR values falsely cause errors
The logs for the first case are in spaces-in-record-names.log in the gist linked above. A successful workaround for this case is to manually escape the record names. Using name = "This\\ is\\ a\\ test" yields the expected result. The same workaround can be used for SRV targets. I have not tested the other record types.
The logs for the second case are in spaces-in-ptr.log in the gist linked above. This case occurs if the PTR value is escaped using the workaround mentioned above. In this case the record is successfully created. However the value of the created record is seen by terraform only up to the first space, so on every subsequent run an update is planned. However since trimming the PTR value like this makes it a non fully qualified domain the plugin raises an error. I have not yet found a workaround for this.
Code of Conduct
I agree to follow this project's Code of Conduct
The text was updated successfully, but these errors were encountered:
Terraform CLI and Provider Versions
Terraform Configuration
Expected Behavior
I expect the DNS provider to automatically escape special characters in record names and in all places that reference record names. I expect the provided example configuration to be applied successfully.
Actual Behavior
Terraform crashes during the
apply
command.Steps to Reproduce
<zone>
,<server>
,<REALM>
,<username>
, and<password>
. I suspect that the issue also occurs when using keys for authentication, but I did not test that.terraform apply
yes
and hit enterHow much impact is this issue causing?
Medium
Logs
https://gist.github.com/codello/6a2137e7bb0f5af522d7962d448840da
Additional Information
This issue has two variants:
The logs for the first case are in
spaces-in-record-names.log
in the gist linked above. A successful workaround for this case is to manually escape the record names. Usingname = "This\\ is\\ a\\ test"
yields the expected result. The same workaround can be used for SRV targets. I have not tested the other record types.The logs for the second case are in
spaces-in-ptr.log
in the gist linked above. This case occurs if the PTR value is escaped using the workaround mentioned above. In this case the record is successfully created. However the value of the created record is seen by terraform only up to the first space, so on every subsequent run an update is planned. However since trimming the PTR value like this makes it a non fully qualified domain the plugin raises an error. I have not yet found a workaround for this.Code of Conduct
The text was updated successfully, but these errors were encountered: