go-gandi / terraform-provider-gandi

Terraform provider for the Gandi Domain services
Mozilla Public License 2.0
152 stars 47 forks source link

Feature request: add FQDN attribute to gandi_livedns_record #116

Open KillianKemps opened 2 years ago

KillianKemps commented 2 years ago

Currently, when referencing a record into another CNAME, I need to write something like this in the values argument:

resource "gandi_livedns_record" "my-website-fr-CNAME" {
  zone   = gandi_livedns_domain.my-website-fr.id
  name   = "subdomain"
  type   = "CNAME"
  ttl    = 1800
  values = ["${gandi_livedns_record.my-website-fr.name}.${gandi_livedns_record.my-website-fr.zone}."]
}

It would be nice to be able to only write this:

resource "gandi_livedns_record" "my-website-fr-CNAME" {
  zone   = gandi_livedns_domain.my-website-fr.id
  name   = "subdomain"
  type   = "CNAME"
  ttl    = 1800
  values = ["${gandi_livedns_record.my-website-fr.fqdn}."]
}

Would it be possible to add something named like the fqdn attribute on gandi_livedns_record?

Also, when I looked into the [source code](https://github.com/go-gandi/terraform-provider-gandi/blob/master/gandi/resource_livedns_record.go#L28, I was puzzled because the comment for the zone attribute is The FQDN of the domain when in fact, it is not the [FQDN](https://en.wikipedia.org/wiki/Fully_qualified_domain_name, but the root zone.

nlewo commented 2 years ago

It could be possible to add a computed value in the gandi_livedns_record. However, i don't know if it could be computed during the plan phase. If not, i don't think it's a good idea since we would have to deploy the resource to know this fqdn value.

So, if it can be computed during the plan phase, then a PR is welcome ;)

I was puzzled because the comment for the zone attribute is The FQDN of the domain

Yep, maybe should be something such as The FQDN of this domain zone (it's not the root zone however).