How to add a DNS record in GCP using Terraform

0 votes

Hi Team,

I am new to the GCP cloud. I want to add a DNS record in GCP using Terraform. How can I create that?

Dec 1, 2020 in Terraform by akhtar
• 38,220 points
421 views

1 answer to this question.

0 votes

Hi@akhtar,

You can use the google_dns_managed_zone resource to create a DNS record in GCP. 

resource "google_dns_managed_zone" "example" {
  name     = "example"
  dns_name = "example.com."
}
resource "google_dns_record_set" "example" {
  managed_zone = google_dns_managed_zone.example.name

  name    = "www.${google_dns_managed_zone.example.dns_name}"
  type    = "A"
  rrdatas = ["10.1.2.1", "10.1.2.2"]
  ttl     = 300
}
answered Dec 1, 2020 by MD
• 95,320 points

Related Questions In Terraform

0 votes
1 answer

How to create a service account key in GCP Cloud using Terraform?

Hi@akhtar, You need to create a service account ...READ MORE

answered Sep 13, 2020 in Terraform by MD
• 95,320 points
669 views
0 votes
1 answer

How to create a VPC in GCP Cloud using Terraform code?

Hi@akhtar, You can create your own VPC in ...READ MORE

answered Sep 13, 2020 in Terraform by MD
• 95,320 points
619 views
0 votes
1 answer

How to set an IAM policy for a project in GCP using Terraform?

Hi@akhtar, You can create a policy and give ...READ MORE

answered Sep 13, 2020 in Terraform by akhtar
• 38,220 points
336 views
0 votes
2 answers

How to create a customized IAM policy in GCP using Terraform?

You can visit Terraform official site for ...READ MORE

answered Sep 14, 2020 in Terraform by Peter
• 180 points
613 views
0 votes
1 answer
0 votes
1 answer

Error:No credentials loaded. To use your gcloud credentials, run 'gcloud auth application-default login'.

Hi@akhtar, You are trying to connect the GCP ...READ MORE

answered Sep 12, 2020 in Terraform by MD
• 95,320 points
2,225 views
0 votes
1 answer

How to use GCP provider in Terraform?

Hi@akhtar, Terraform supports many providers to deploy the ...READ MORE

answered Sep 12, 2020 in Terraform by MD
• 95,320 points
228 views
0 votes
1 answer

How to launch an instance in GCP using Terraform?

Hi@akhtar, You can use the google_compute_instance resource in ...READ MORE

answered Sep 12, 2020 in Terraform by MD
• 95,320 points
202 views
0 votes
1 answer

How to add a route for IGW in AWS using Terraform code?

Hi@akhtar, Terraform has one keyword named route. It allows ...READ MORE

answered Jul 22, 2020 in Terraform by MD
• 95,320 points
740 views
0 votes
1 answer

How to create a service account in GCP using Terraform?

Hi@akhtar, You can create a service account in ...READ MORE

answered Sep 13, 2020 in Terraform by MD
• 95,320 points
737 views