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

"masters" attribute is always empty for opentelekomcloud_dns_zone_v2 public zone #1703

Closed
kbechler opened this issue Apr 15, 2022 · 7 comments · Fixed by #1715
Closed

"masters" attribute is always empty for opentelekomcloud_dns_zone_v2 public zone #1703

kbechler opened this issue Apr 15, 2022 · 7 comments · Fixed by #1715
Assignees

Comments

@kbechler
Copy link

Terraform provider version

Terraform v1.1.7

Affected Resource(s)

opentelekomcloud_dns_zone_v2

Terraform Configuration Files

terraform {
  required_version = ">= 0.15.0, < 2.0"
  required_providers {
    opentelekomcloud = {
      source  = "opentelekomcloud/opentelekomcloud"
      version = "= 1.29.1"
    }
  }
}

provider "opentelekomcloud" {
  tenant_name = "eu-de"
  auth_url    = "https://iam.eu-de.otc.t-systems.com/v3"
}

resource "opentelekomcloud_dns_zone_v2" "this" {
  name = "some.domain.tld."
  type = "public"
}

output "masters" { value = opentelekomcloud_dns_zone_v2.this.masters }

Steps to Reproduce

terraform apply

Expected Behavior

I should see a list of NS servers for newly created zone

What actually happened?

Empty output:
masters = toset([])

Important Factoids

API allows getting name servers for a public zone:

https://docs.otc.t-systems.com/en-us/api/dns/dns_api_62004.html,

@lego963
Copy link
Contributor

lego963 commented Apr 15, 2022

@kbechler as I can see description in hc doc

Master DNS servers, from which the slave servers get DNS information
This parameter is not used currently.

nameserver is another attribute

@lego963 lego963 added this to the v1.29.2 milestone Apr 15, 2022
@outcatcher
Copy link
Contributor

I suppose, as there is masters attribute in API documentation (not working), it's better to use name_servers attribute or dedicated data source for getting list of the name servers for the zone with the following API: https://docs.otc.t-systems.com/en-us/api/dns/dns_api_62004.html

@vladimirvshivkov
Copy link
Contributor

@kbechler We might return a list of nameservers? But in this case, there may be not only master servers.
Will this be acceptable for you?

@kbechler
Copy link
Author

@vladimirvshivkov My goal is to automate the process of adding new zone. If it will be a valid list of nameservers that could be used to configure NS delegation in parent zone, if will be acceptable for me.

On the other hand, maybe such variable should be called "nameservers", not "masters" as the latter one would be confusing.

@vladimirvshivkov vladimirvshivkov linked a pull request Apr 27, 2022 that will close this issue
4 tasks
@otc-zuul otc-zuul bot closed this as completed in #1715 Apr 27, 2022
otc-zuul bot pushed a commit that referenced this issue Apr 27, 2022
[DNS] Add `data_source/opentelekomcloud_dns_nameserver_v2`

Summary of the Pull Request
PR Checklist

 Refers to: #1703, #1704
 Tests added/passed.
 Schema updated.
 Release notes added.

Acceptance Steps Performed
=== RUN   TestAccDNSV2NameserverDataSource_basic
--- PASS: TestAccDNSV2NameserverDataSource_basic (43.78s)
PASS

Process finished with exit code 0

Reviewed-by: Anton Kachurin <katchuring@gmail.com>
@outcatcher outcatcher removed this from the v1.29.2 milestone Apr 27, 2022
@outcatcher
Copy link
Contributor

Implementing as masters requires API changes

@outcatcher outcatcher added the otc-issue Blocked by OTC issues label Apr 27, 2022
@vladimirvshivkov
Copy link
Contributor

vladimirvshivkov commented Apr 27, 2022

@kbechler
We released a new version with DNS nameservers data source.

try to use this config:

terraform {
  required_version = ">= 0.15.0, < 2.0"
  required_providers {
    opentelekomcloud = {
      source  = "opentelekomcloud/opentelekomcloud"
      version = "= 1.29.2"
    }
  }
}

provider "opentelekomcloud" {
  tenant_name = "eu-de"
  auth_url    = "https://iam.eu-de.otc.t-systems.com/v3"
}

resource "opentelekomcloud_dns_zone_v2" "zone_1" {
  name        = "test-zone-1.com."
  email       = "email1@example.com"
  description = "a public zone"
  ttl         = 3000
  type        = "public"
}

data "opentelekomcloud_dns_nameservers_v2" "nameservers" {
  zone_id = opentelekomcloud_dns_zone_v2.zone_1.id
}

output "masters" { value = data.opentelekomcloud_dns_nameservers_v2.nameservers }

this outputs the following:

masters = {
  "id" = "ns1.open-telekom-cloud.com."
  "nameservers" = tolist([
    {
      "hostname" = "ns1.open-telekom-cloud.com."
      "priority" = 1
    },
    {
      "hostname" = "ns2.open-telekom-cloud.com."
      "priority" = 2
    },
  ])
  "zone_id" = "ff80808275f5fc0f01806ba10ea62b11"
}

Can't wait for your feedback!

@vladimirvshivkov
Copy link
Contributor

@kbechler,
If this is still relevant for you, reopen the issue, please.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants