Google Cloud DNS Record Set
This page shows how to write Terraform for Cloud DNS Record Set and write them securely.
The Record Set in Cloud DNS can be configured in Terraform with the resource name
google_dns_record_set. The following sections describe how to use the resource and its parameters.
Example Usage from GitHub
An example could not be found in GitHub.
Identifies the managed zone addressed by this request.
namerequired - string
For example, www.example.com.
The string data for the records in this record set whose meaning depends on the DNS type. For TXT record, if the string data contains spaces, add surrounding " if you don't want your string to get split on spaces. To specify a single record value longer than 255 characters such as a TXT record for DKIM, add "" inside the Terraform configuration string (e.g. "first255characters""morecharacters").
ttloptional - number
Number of seconds that this ResourceRecordSet can be cached by resolvers.
typerequired - string
One of valid DNS resource types. Possible values: ["A", "AAAA", "CAA", "CNAME", "MX", "NAPTR", "NS", "PTR", "SOA", "SPF", "SRV", "TLSA", "TXT"]
Explanation in Terraform Registry
Note: The provider treats this resource as an authoritative record set. This means existing records (including the default records) for the given type will be overwritten when you create this resource in Terraform. In addition, the Google Cloud DNS API requires NS records to be present at all times, so Terraform will not actually remove NS records during destroy but will report that it did.
Tips: Best Practices for The Other Google Cloud DNS Resources
In addition to the google_dns_managed_zone, Google Cloud DNS has the other resources that should be configured for security reasons. Please check some examples of those resources and precautions.
Ensure DNSSEC for your Cloud DNS zone is enabled
It is better to enable DNSSEC unless the zone is private. DNSSEC prevents attackers from running several attacks for the DNS zone.