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 В разделе "Sysadmin" от 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
    

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

    Starting MSSQL in Amazon RDS with Terraform

    № 10191 В разделе "Sysadmin" от August 9th, 2019,
    В подшивках: , ,

    resource "aws_db_instance" "default_mssql" {
      identifier = "test-mssql"
      final_snapshot_identifier = "test-mssql"
      license_model             = "license-included"
      instance_class = "db.m4.large"
      storage_type              = "gp2"
      engine                    = "sqlserver-se"
      engine_version = "12.00.4422.0.v1"
      vpc_security_group_ids = ["${aws_security_group.mssql_security_group.id}"]
      username         = "master_chief"
      password         = "MueQuopdsdSDFG%45esdfgsdf"
      allocated_storage = 50 // not less than 50 Gb
      publicly_accessible = true // if you want to connect remotely
      storage_encrypted = true 
      skip_final_snapshot = true
    }
    
    resource "aws_security_group" "mssql_security_group" {
      name        = "test_mssql_group"
      description = "Allow all inbound traffic"
    
      ingress {
        from_port   = 1433
        to_port     = 1433
        protocol    = "tcp"
        cidr_blocks = ["0.0.0.0/0"]
      }
    
      egress {
        from_port   = 0
        to_port     = 0
        protocol    = "-1"
        cidr_blocks = ["0.0.0.0/0"]
      }
    
    }
    
    // Identifier of the mssql DB instance.
    output "mssql_id" {
      value = "${aws_db_instance.default_mssql.id}"
    }
    
    // Address of the mssql DB instance.
    output "mssql_address" {
      value = "${aws_db_instance.default_mssql.address}"
    }
    

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

    Terraform for Hetzner Cloud: 2 balancers, 2 floating IPs, 4 nodes and SSH key

    № 9426 В разделе "Sysadmin" от September 19th, 2018,
    В подшивках: ,

    How to run:

    • In Hetzner control panel create token in Access tab
    • Download my repo and install terraform (suddenly it required to execute terraform files)
    • Configure tf files as you need, put your token into project.tf file
    • Run terraform init and terraform apply after it

    DO NOT FORGET TO MAKE YOUR OWN SSH MASTER KEY! DO NOT USE GENERATED FOR THIS EXAMPLE!

    You can download it here https://git.blindage.org/21h/terraform-samples

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

    Terraform docker provider: wordpress + mysql

    № 9409 В разделе "Sysadmin" от September 13th, 2018,
    В подшивках: , ,

    Terraform infrastructure sample for docker provider. Creates docker containers on local machine.

    CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                 NAMES
    a647e8f04629        6a834f03bd02        "docker-entrypoint.s…"   10 minutes ago      Up 10 minutes       3306/tcp, 33060/tcp   mysql
    e69d24a3920a        63b422244491        "docker-entrypoint.s…"   13 minutes ago      Up 13 minutes       80/tcp                wordpress
    

    How to run:

    vlad@turtle:$ terraform init
    
    ... some strings
    
    vlad@turtle:$ terraform apply
     
    ... some strings
    
    Apply complete! Resources: 2 added, 0 changed, 0 destroyed.
    
    Outputs:
    
    address_my = 172.17.0.2
    address_wp = 172.17.0.3
    

    You can find repository here https://git.blindage.org/21h/terraform-samples

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

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

    # 2019-12-23 09:14:01

    Очень интересная концепция, docker-compose для kubernetes kompose.io/ #devops #kubernetes #docker

    # 2019-12-16 17:21:18

    Надо будет почитать для общего развития как оживить кластер в случае проеба сертов habr.com/ru/company/southbridg #kubernetes #devops

    # 2019-12-12 17:33:46

    js bootstrap с интерфейсом как в DOS github.com/kristopolous/BOOTST


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

    Fortune cookie: A young Juliet of St. Louis On a balcony stood acting screwy. Her Romeo climbed, But he wasn't well timed, And half-way up, off he went -- blooey!