INT 21h

Hi, I am Vladimir Smagin, SysAdmin, DevOps and barely good guy. Telegram Email / GIT / Микроблог / Thingiverse / GPG

Import DNS resources from DigitalOcean to Terraform

№ 10401 В разделе "Администрирование" от November 19th, 2019,

At first, create digitalocean.tf with auth token if you do not have one.

Carefully read documentation:

  • https://www.terraform.io/docs/providers/do/r/domain.html
  • https://www.terraform.io/docs/providers/do/r/record.html
  • Now prepare domains.tf with resources declaration:

    resource "digitalocean_domain" "k8s_blindage_org" {
      name = "k8s.blindage.org"
    }
    
    resource "digitalocean_record" "k8s_blindage_org_ns1" {
      domain = digitalocean_domain.k8s_blindage_org.name
      type   = "NS"
      name   = "@"
      value  = "ns1.digitalocean.com."
    }
    
    resource "digitalocean_record" "k8s_blindage_org_ns2" {
      domain = digitalocean_domain.k8s_blindage_org.name
      type   = "NS"
      name   = "@"
      value  = "ns2.digitalocean.com."
    }
    
    resource "digitalocean_record" "k8s_blindage_org_ns3" {
      domain = digitalocean_domain.k8s_blindage_org.name
      type   = "NS"
      name   = "@"
      value  = "ns3.digitalocean.com."
    }
    

    Authorize and receive list of records with IDs:

    export DO_TOKEN=fed82d66020b4ccfa67d53d45a519fuck6d3you0c946a9cd196f1062195a7993
    curl -X GET https://api.digitalocean.com/v2/domains/k8s.blindage.org/records -H "Authorization:Bearer ${DO_TOKEN}"

    Now you are ready to import current state with record IDs from previous step:

    terraform import digitalocean_domain.k8s_blindage_org k8s.blindage.org
    terraform import digitalocean_record.k8s_blindage_org_ns1 k8s.blindage.org,80019903
    terraform import digitalocean_record.k8s_blindage_org_ns2 k8s.blindage.org,80019904
    terraform import digitalocean_record.k8s_blindage_org_ns3 k8s.blindage.org,80019905
    

    Нет комментариев »

    Leave a Reply

    Your email address will not be published. Required fields are marked *

    *

    Микроблог перейти

    # 2019-11-20 13:13:54

    Говорят вещь хорошая, надо будет поковырять на днях keel.sh/ #kubernetes #devops

    # 2019-11-16 02:02:31

    Хорошая шпаргалка по пластикам для печати drive.google.com/file/d/1NKB3- В принципе, данные практически сходятся с моими blindage.org/?p=10199

    # 2019-11-14 15:29:01

    Код quay теперь открыт www.projectquay.io/ #devops #kubernetes


    © Vladimir Smagin, 2005-2019. Копирование материалов без разрешения запрещено. GPG DA4CD0F5E222EA727D6A40C413BCE12E5618F071 *
    Яндекс.Метрика

    Fortune cookie: "Labor is the only prayer that Nature answers." [Robert G. Ingersoll, "Address to the Jury", trial of C. B. Reynolds for Blasphemy]