Google Cloud DNS Record Set

This page shows how to write Terraform for Cloud DNS Record Set and write them securely.

google_dns_record_set (Terraform)

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.

Review your Terraform file for Google best practices

Shisho Cloud, our free checker to make sure your Terraform configuration follows best practices, is available (beta).

Parameters

Identifies the managed zone addressed by this request.

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").

  • ttl optional - number

Number of seconds that this ResourceRecordSet can be cached by resolvers.

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

Manages a set of DNS records within Google Cloud DNS. For more information see the official documentation and API.

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.

risk-label

google_dns_managed_zone

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.

Review your Google Cloud DNS settings

In addition to the above, there are other security points you should be aware of making sure that your .tf files are protected in Shisho Cloud.

Frequently asked questions

What is Google Cloud DNS Record Set?

Google Cloud DNS Record Set is a resource for Cloud DNS of Google Cloud Platform. Settings can be wrote in Terraform.

security-icon

Automate config file reviews on your commits

Fix issues in your infrastructure as code with auto-generated patches.