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

NS subdomain working example in docs #142

Open
maxkokocom opened this issue Mar 17, 2023 · 4 comments
Open

NS subdomain working example in docs #142

maxkokocom opened this issue Mar 17, 2023 · 4 comments

Comments

@maxkokocom
Copy link

Hi, I tried adding NS subdomain record, documentation has two ways of doing so, but both did not worked for me, maybe I am missing obv syntax?

Version I am using is: "2.1.0"

1 way I tried adding subdomain NS:

resource "gandi_livedns_record" "ns_dns_record" {
  for_each = local.ns
  zone     = each.value.domain
  name     = each.key
  type     = "NS"
  ttl      = each.value.ttl
  values   = each.value.value
}

locals {
  ns = {
    "aws" : {
      ttl    = 300
      value  = ["ns-1.net", "ns-2.com", "ns-3.co.uk", "ns-4.org"]
      domain = "aws.yyy.xxx."
    }
  }
}

2nd way I tried was:

resource "gandi_nameservers" "ns_dns_record" {
  for_each = local.ns
  domain     = each.value.domain
  name     = each.key
  nameservers   = each.value.value
}

the gandi_livedns_record type NS failed at plan stage with:
StatusCode: 404 ; Err: 404: The resource could not be found.

the gandi_nameservers failed at apply stage with:

gandi_nameservers.ns_dns_record["aws"]: Creating...
╷
│ Error: StatusCode: 404 ; Err: 404: The resource could not be found. 
│ 
│   with gandi_nameservers.ns_dns_record["aws"],
│   on main.tf line 37, in resource "gandi_nameservers" "ns_dns_record":
│   37: resource "gandi_nameservers" "ns_dns_record" {

I would appreciate anwser which resource type should I use and maybe a basic example to know why it's failing.

@maxkokocom
Copy link
Author

Update, it seems StatusCode: 404 ; Err: 404: The resource could not be found.

Is a result of trying to apply initially. After removing NS records changes it still is raising this error even in the plan stage.

@maxkokocom
Copy link
Author

Okey, so I think this is actually some sort of a bug and ticket name should be different, I needed to manually remove this resource:
terraform state rm gandi_nameservers.ns_dns_record
which on the previous run provider failed to create, but it still added it to the state file so the following plans were complaining that a resource could not be found.

I would still appreciate an example how to do nameservers, but this may be something else entriely.

@marcaurele
Copy link

We had the issue which caused us an outage. You should not use the resource gandi_livedns_record for NS records to point to another DNS provider, but use the gandi_nameservers resource. Remove the NS entries from the state file under the gandi_livedns_record.

@marcaurele
Copy link

But be aware of #149 that I just opened as their API / provider does not work well.

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

No branches or pull requests

2 participants