IT Cloud. Eugeny Shtoltc

Чтение книги онлайн.

Читать онлайн книгу IT Cloud - Eugeny Shtoltc страница 37

IT Cloud - Eugeny Shtoltc

Скачать книгу

= "bucket / terraform.tfstate"

      region = "us-east-1"

      encrypt = "true"

      }

      }

      $ cat cloud.tf # cloud configuration

      provider "google" {

      token = "$ {var.hcloud_token}"

      }

      $ cat variables.tf # variables and getting tokens

      variable "hcloud_token" {}

      $ cat instances.tf # create resources

      resource "hcloud_server" "server" {....

      $ terraform import aws_acm_certificate.cert arn: aws: acm: eu-central-1: 123456789012: certificate / 7e7a28d2-163f-4b8f-b9cd-822f96c08d6a

      $ terraform init # Initialize configs

      $ terraform plan # Check actions

      $ terraform apply # Running actions

      Debugging:

      essh @ kubernetes-master: ~ / graylog $ sudo docker run –name graylog –link graylog_mongo: mongo –link graylog_elasticsearch: elasticsearch \

      –p 9000: 9000 -p 12201: 12201 -p 1514: 1514 \

      –e GRAYLOG_HTTP_EXTERNAL_URI = "http://127.0.0.1:9000/" \

      –d graylog / graylog: 3.0

      0f21f39192440d9a8be96890f624c1d409883f2e350ead58a5c4ce0e91e54c9d

      docker: Error response from daemon: driver failed programming external connectivity on endpoint graylog (714a6083b878e2737bd4d4577d1157504e261c03cb503b6394cb844466fb4781): Bind for 0.0.0.0:9000 failed: port is already allocated.

      essh @ kubernetes-master: ~ / graylog $ sudo netstat -nlp | grep 9000

      tcp6 0 0 ::: 9000 ::: * LISTEN 2505 / docker-proxy

      essh @ kubernetes-master: ~ / graylog $ docker rm graylog

      graylog

      essh @ kubernetes-master: ~ / graylog $ sudo docker run –name graylog –link graylog_mongo: mongo –link graylog_elasticsearch: elasticsearch \

      –p 9001: 9000 -p 12201: 12201 -p 1514: 1514 \

      –e GRAYLOG_HTTP_EXTERNAL_URI = "http://127.0.0.1:9001/" \

      –d graylog / graylog: 3.0

      e5aefd6d630a935887f494550513d46e54947f897e4a64b0703d8f7094562875

      https://blog.maddevs.io/terrafom-hetzner-a2f22534514b

      For example, let's create one instance:

      $ cat aws / provider.tf

      provider "aws" {

      region = "us-west-1"

      }

      resource "aws_instance" "my_ec2" {

      ami = "$ {data.aws_ami.ubuntu.id}"

      instance_type = "t2.micro"

      }

      $ cd aws

      $ aws configure

      $ terraform init

      $ terraform apply –auto-approve

      $ cd ..

      provider "aws" {

      region = "us-west-1"

      }

      resource "aws_sqs_queue" "terraform_queue" {

      name = "terraform-queue"

      delay_seconds = 90

      max_message_size = 2048

      message_retention_seconds = 86400

      receive_wait_time_seconds = 10

      }

      data "aws_route53_zone" "vuejs_phalcon" {

      name = "test.com."

      private_zone = true

      }

      resource "aws_route53_record" "www" {

      zone_id = "$ {data.aws_route53_zone.vuejs_phalcon.zone_id}"

      name = "www. $ {data.aws_route53_zone.selected.name}"

      type = "A"

      ttl = "300"

      records = ["10.0.0.1"]

      }

      resource "aws_elasticsearch_domain" "example" {

      domain_name = "example"

      elasticsearch_version = "1.5"

      cluster_config {

      instance_type = "r4.large.elasticsearch"

      }

      snapshot_options {

      automated_snapshot_start_hour = 23

      }

      }

      resource "aws_eks_cluster" "eks_vuejs_phalcon" {

      name = "eks_vuejs_phalcon"

      role_arn = "$ {aws_iam_role.eks_vuejs_phalcon.arn}"

      vpc_config {

      subnet_ids = ["$ {aws_subnet.eks_vuejs_phalcon.id}", "$ {aws_subnet.example2.id}"]

      }

      }

      output "endpoint" {

      value = "$ {aws_eks_cluster.eks_vuejs_phalcon.endpoint}"

      }

      output "kubeconfig-certificate-authority-data" {

      value = "$ {aws_eks_cluster.eks_vuejs_phalcon.certificate_authority.0.data}"

      }

      provider "google" {

      credentials = "$ {file (" account.json ")}"

      project = "my-project-id"

      region = "us-central1"

      }

      resource "google_container_cluster" "primary" {

      name = "my-gke-cluster"

Скачать книгу