0

I am creating a AZURE DNS zone & NS records using a terraform script.

resource "azurerm_resource_group" "dns_management" {
name     = "dns-managment"
location = "West US"
}

resource "azurerm_dns_zone" "mydomaincom" {
name                = "mdomain.com"
resource_group_name = "${azurerm_resource_group.dns_management.name}"
}

resource "azurerm_dns_a_record" "projectmydomain" {
name                = "project"
zone_name           = "${azurerm_dns_zone.mydomaincom.name}"
resource_group_name = "${azurerm_resource_group.dns_management.name}"
ttl                 = 300
records             = ["127.0.0.1"]
}

I want to copy these AZURE NS record to a gcp cloud DNS managed zone. I am trying to do that with Gcloud commands using terraform script. How to use Gcloud commands with Terraform?

Hans
  • 308
  • 7
  • 20
  • It is not clear what you are asking for. Do you mean you want to execute the program **gcloud** inside your Terraform HCL or do you want gcloud to read/process your Terraform HCL? Edit your question to clearly state your problem with a detailed description. – John Hanley Oct 29 '21 at 14:52
  • I don't know how helpful this is, but the Google Cloud SDK (`gcloud`) and both GCP Terraform providers (`google` and `google-beta`) make use of the GCP REST API (more on that [here](https://cloud.google.com/dns/docs/reference/v1)). – Mike Nov 20 '21 at 17:53
  • If you have at least one Google Kubernetes Engine cluster running in the Google Cloud Platform project you wish to generate this IaC for, you could also look into Config Connector [here](https://cloud.google.com/config-connector/docs/reference/resource-docs/dns/dnsmanagedzone). – Mike Nov 20 '21 at 17:56

0 Answers0