Giter Club home page Giter Club logo

Comments (3)

timohirt avatar timohirt commented on June 2, 2024

You don't need the data source in the first example. It is never used. You only need the data source if the corresponding resource is created in another project.

resource "hetznerdns_zone" "example_at" {
    name = "example.at"
    ttl = 3600
}
resource "hetznerdns_record" "example_at" {
    zone_id = hetznerdns_zone.example_at.id
    name = "@"
    value = "127.0.0.1"
    type = "A"
    ttl= 3600
}

Above I copied and modified your code. Terraform uses the reference to hetznerdns_zone.example_at.id to determine the order in this resources are being created. Without the reference it might create the record before the zone, which would result in errors.

from terraform-provider-hetznerdns.

timohirt avatar timohirt commented on June 2, 2024

Hey @c33s! Have you tried removing the data source? It is not used in the code you provided and I think you can just remove it. I'll close this issue. Please reopen if you still need the data source.

from terraform-provider-hetznerdns.

c33s avatar c33s commented on June 2, 2024

the ticket isn't about the datasource, yes i included the datasource as it was in the example in the docs but it's of course not required.

this ticket is about the requirement to access a zone over a id instead of it's name. a zones name is unique, so why not access it via its name. see the zone instead of the zone_id

resource "hetznerdns_record" "example_at" {
    zone_id = "${hetznerdns_zone.example_at.id}"
    name = "@"
    value = "127.0.0.1"
    type = "A"
    ttl= 3600
}
resource "hetznerdns_record" "example_at" {
    zone = "example.at"
    name = "@"
    value = "127.0.0.1"
    type = "A"
    ttl= 3600
}

internally the provider could fetch the zone ids over the datasource (and maybe cache them?) and let the developer access the zones by their real name. it's a general hetzner problem that there are sometimes unneeded ids instead of the real unique identifieres of a resource (like the name of a zone for dns or the fingerprint of an ssh key . for accessing those resources we have to make our way trough datasources even if we already have or know a unique id).

from terraform-provider-hetznerdns.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.