Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AZURERM_DNS_ZONE attribute to output attribute name_servers #7374

Closed
i-am-logger opened this issue Jun 27, 2016 · 13 comments · Fixed by #7434
Closed

AZURERM_DNS_ZONE attribute to output attribute name_servers #7374

i-am-logger opened this issue Jun 27, 2016 · 13 comments · Fixed by #7434

Comments

@i-am-logger
Copy link

i-am-logger commented Jun 27, 2016

dns

resource "azurerm_dns_zone" "dns" {
   name = "${var.environment}.local"
   resource_group_name = "${azurerm_resource_group.compute.name}"
}
resource "azurerm_dns_a_record" "dns-record" {
   name = "${var.name}"
   zone_name = "${azurerm_dns_zone.dns.name}"
   resource_group_name = "${azurerm_resource_group.compute.name}"
   ttl = "300"
   records = ["${azurerm_network_interface.nic.*.private_ip_address}"]
}


resource "azurerm_virtual_network" "network" {
    name = "virtual-network"
    address_space = ["10.0.0.0/16"]
    location = "${azurerm_resource_group.compute.location}"
    resource_group_name = "${azurerm_resource_group.compute.name}"
    dns_servers = **[${azurerm_dns_zone.dns.name_servers}]**
}
@i-am-logger i-am-logger changed the title AZURERM_DNS_ZONE attribute to explose name servers AZURERM_DNS_ZONE attribute to expose name servers Jun 27, 2016
@i-am-logger i-am-logger changed the title AZURERM_DNS_ZONE attribute to expose name servers AZURERM_DNS_ZONE attribute to output attribute name_servers Jun 27, 2016
@stack72
Copy link
Contributor

stack72 commented Jun 27, 2016

Hi @isamuelson

the Azure go-sdk doesn't seem to expose the name servers when a zone is created. I will raise a ticket with Azure now but this will take a while AFAICT

Paul

@i-am-logger
Copy link
Author

i-am-logger commented Jun 27, 2016

ok thanks, meanwhile is there a way to execute a command and get the results as an output ?
"azure network dns record-set show ${azurerm_resource_group.compute.name} ${azurerm_dns_zone.dns.name} @ NS --json | jq '.properties.nsRecords | map(.nsdname)'"

@stack72
Copy link
Contributor

stack72 commented Jun 27, 2016

Fraid not :(

FYI, the issue is being tracked here Azure/azure-sdk-for-go#346

@i-am-logger
Copy link
Author

thank you

@i-am-logger
Copy link
Author

v3.0.0-beta release has the changes

@stack72
Copy link
Contributor

stack72 commented Jun 30, 2016

@isamuelson yeah, the SDK has a lot of breaking changes so i am trying to make my way through to make sure that all works as expected

stack72 added a commit that referenced this issue Jun 30, 2016
Fixes #7374

The introduction of the AzureRM SDK 3.0.0-beta means that the
`name_servers` for the DNS Zone are returned from the API

This PR has a dependency on #7420 being merged first

```
make testacc TEST=./builtin/providers/azurerm TESTARGS='-run=TestAccAzureRMDnsZone_'
==> Checking that code complies with gofmt requirements...
/Users/stacko/Code/go/bin/stringer
go generate $(go list ./... | grep -v /vendor/)
2016/06/30 15:20:01 Generated command/internal_plugin_list.go
TF_ACC=1 go test ./builtin/providers/azurerm -v
-run=TestAccAzureRMDnsZone_ -timeout 120m
=== RUN   TestAccAzureRMDnsZone_basic
--- PASS: TestAccAzureRMDnsZone_basic (92.42s)
PASS
ok      github.com/hashicorp/terraform/builtin/providers/azurerm
92.444s
```
stack72 added a commit that referenced this issue Jun 30, 2016
Fixes #7374

The introduction of the AzureRM SDK 3.0.0-beta means that the
`name_servers` for the DNS Zone are returned from the API

This PR has a dependency on #7420 being merged first

```
make testacc TEST=./builtin/providers/azurerm TESTARGS='-run=TestAccAzureRMDnsZone_'
==> Checking that code complies with gofmt requirements...
/Users/stacko/Code/go/bin/stringer
go generate $(go list ./... | grep -v /vendor/)
2016/06/30 15:20:01 Generated command/internal_plugin_list.go
TF_ACC=1 go test ./builtin/providers/azurerm -v
-run=TestAccAzureRMDnsZone_ -timeout 120m
=== RUN   TestAccAzureRMDnsZone_basic
--- PASS: TestAccAzureRMDnsZone_basic (92.42s)
PASS
ok      github.com/hashicorp/terraform/builtin/providers/azurerm
92.444s
```
stack72 added a commit that referenced this issue Jul 1, 2016
Fixes #7374

The introduction of the AzureRM SDK 3.0.0-beta means that the
`name_servers` for the DNS Zone are returned from the API

This PR has a dependency on #7420 being merged first

```
make testacc TEST=./builtin/providers/azurerm TESTARGS='-run=TestAccAzureRMDnsZone_'
==> Checking that code complies with gofmt requirements...
/Users/stacko/Code/go/bin/stringer
go generate $(go list ./... | grep -v /vendor/)
2016/06/30 15:20:01 Generated command/internal_plugin_list.go
TF_ACC=1 go test ./builtin/providers/azurerm -v
-run=TestAccAzureRMDnsZone_ -timeout 120m
=== RUN   TestAccAzureRMDnsZone_basic
--- PASS: TestAccAzureRMDnsZone_basic (92.42s)
PASS
ok      github.com/hashicorp/terraform/builtin/providers/azurerm
92.444s
```
@i-am-logger
Copy link
Author

@stack72 is there a way to resolve the name_servers to list of IPs so it can be used on Virtual Network or Network Interface dns_servers?

@stack72
Copy link
Contributor

stack72 commented Jul 6, 2016

Hi @isamuelson

These are the only things that come back from the API - you will need to resolve them on your side I'm afraid. Terraform has nothing that can do that

Paul

@i-am-logger
Copy link
Author

can we create a util function on terraform to resolve dns to ip ?

@stack72
Copy link
Contributor

stack72 commented Jul 7, 2016

@isamuelson IMO i think it's best to not try and resolve the IPs. The IPs may be subject to change. Feel free to open a PR that proposes such a function though

Paul

@i-am-logger
Copy link
Author

the name servers ip are static...they do not change.

On Thu, Jul 7, 2016 at 10:44 AM, Paul Stack notifications@github.com
wrote:

@isamuelson https://github.com/isamuelson IMO i think it's best to not
try and resolve the IPs. The IPs may be subject to change. Feel free to
open a PR that proposes such a function though

Paul


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#7374 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/ABX8VBjK_a_RMxIvGJy8EqXYc4MXDEDbks5qTRDUgaJpZM4I_cF1
.

Ido Samuelson

Phone (US): +1-415-562-8582

Email: ido.samuelson@gmail.com
LinkedIn: http://www.linkedin.com/in/isamuelson

Skype: ido_samuelson

@stack72
Copy link
Contributor

stack72 commented Jul 7, 2016

@isamuelson if they can guarantee you that the ips will not change then please do feel free to write something that will do the reverse lookup of the IPs. I am assuming, that as MSFT use a global set of NameServers, that they could potentially fail over at some point. But as I said, this is an assumption

@ghost
Copy link

ghost commented Apr 24, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Apr 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants