Code Monkey home page Code Monkey logo

Comments (7)

kimdre avatar kimdre commented on September 24, 2024 2

No, to create/register the actual domain you still use the inwx_domain resource and define contacts with inwx_domain_contact. However to define dns records for your domain, your first need to create a zone for your domain on a nameserver that will contain those records. Therefore you now have the new inwx_nameserver resource.

Zones are a separate layer between their domain and its dns records, so you could separate your records on different nameservers (e.g. if you have multiple teams that work on different projects with their own subdomains on the same domain)

An example would look like this:

resource "inwx_domain_contact" "example_person" {
  type = "PERSON"
  name = "Example Person"
  street_address = "Example Street 0"
  city = "Example City"
  postal_code = 00000
  state_province = "Example State"
  country_code = "EX"
  phone_number = "+00.00000000000"
  email = "[email protected]"
}

resource "inwx_domain" "example_com" {
  name = "example.com"
  nameservers = [
    "ns.inwx.de",
    "ns2.inwx.de"
  ]
  period = "1Y"
  renewal_mode = "AUTOEXPIRE"
  transfer_lock = true
  contacts {
    // references to terraform managed contact "example_person"
    registrant = inwx_domain_contact.example_person.id
    admin  = inwx_domain_contact.example_person.id
    tech  = inwx_domain_contact.example_person.id
    billing  = inwx_domain_contact.example_person.id
  }
  extra_data = {
    // Enable e.g. whois protection
    "WHOIS-PROTECTION": "1" // 1 == bool true
  }
}

resource "inwx_nameserver" "example_com_ns" {
  domain = inwx_domain.example_com.name
  type = "MASTER"
  nameservers = [
    "ns.inwx.de",
    "ns2.inwx.de"
  ]
}

resource "inwx_nameserver_record" "example_com_TXT" {
  domain =inwx_nameserver.example_com_ns.domain
  type = "TXT"
  content = "DNS records with terraform"
}

# Using this, all search queries for the subdomain `myproject.example.com` 
# (including sub-subdomains: `*.myproject.example.com`) would go to the nameserver of `provider B`
# where another zone for the domain `example.com` exists, that contains all the records for `myproject`
resource "inwx_nameserver_record" "myproject_example_com_NS" {
  domain = inwx_nameserver.example_com_ns.domain
  name = "myproject.${inwx_nameserver.example_com_ns.domain}"
  type = "NS"
  content = "ns.providerB.com"
}

from terraform-provider-inwx.

kimdre avatar kimdre commented on September 24, 2024 1

You can create zones with this new ressource without having to go to the web ui and you can also reference that ressource in the domain field for inwx_nameserver_record.

from terraform-provider-inwx.

2martens avatar 2martens commented on September 24, 2024

I have been able to import the existing domain into a inwx_domain record but didn't try creating the domain that way.

from terraform-provider-inwx.

kimdre avatar kimdre commented on September 24, 2024

Yes, you could go to the web UI to create a domain entry on the nameserver for your external domain and then import it into your terraform state, but that's not really a good way to do that in my opinion.

from terraform-provider-inwx.

2martens avatar 2martens commented on September 24, 2024

Absolutely. I am currently working on building my own platform and as part of that it would be cool to first fetch with the ordinary API if a domain is available and if so add it to the terraform repo and let terraform claim it.

If the normal Domainrobot API can do it, why is the terraform provider not able to do it?
Here the link to the API documentation for the function domain.create: https://www.inwx.de/de/help/apidoc/f/ch02s09.html#domain.create

from terraform-provider-inwx.

2martens avatar 2martens commented on September 24, 2024

Maybe a stupid question but how does the addition of an additional resource type solve this problem?

from terraform-provider-inwx.

2martens avatar 2martens commented on September 24, 2024

I still don't quite understand: the inwx_domain type contains additional data like contact information, etc. Will inwx_nameserver now create an actual domain? Because it does not actually represent a nameserver. So far inwx_nameserver_record expects a string for domain. Do I understand you correctly that the id of one of the new inwx_nameserver entries would belong in that field?

from terraform-provider-inwx.

Related Issues (11)

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.