2016-10-13 15 views

答えて

0

それは技術的には、それはそれを実行するために、関連する機能を提供しますという意味では、ありません:

https://www.terraform.io/docs/providers/google/r/compute_target_pool.html

残念ながら、それに関するドキュメントは非常に悪く、機能のレイアウトの意味相互依存性のあるヘルスチェック、ターゲットプール、バックエンドハンドラ、および転送ルールをいくつか設定して、それを達成する必要があります。これは他の方法とはまったく異なります。 terraform planapplyに表示されるエラーメッセージもやや役に立たない。

現在、私は手動でセットアップする既存のロードバランサを複製するenvironment.tfをセットアップしようとしています。これは深刻な試行錯誤の挑戦であることが証明されています。 Hashicorpはもっと多くのユースケースと説明をドキュメントに追加する必要があります。

1

2017年9月現在、それは確かにあります!残念なことに、そのドキュメントはそれほど素晴らしいものではありません。

これは非常に難解な例です。コピー/貼り付けだけでは機能しない場合があります。

resource "google_compute_instance_group" "elasticsearch-cluster" { 
    name  = "elasticsearch-cluster" 
    description = "Terraform test instance group" 

    instances = [ 
    "${google_compute_instance.elasticsearch-compute-instance.*.self_link}" 
    ] 

    named_port { 
    name = "elasticsearch-api" 
    port = "9200" 
    } 

    named_port { 
    name = "elasticsearch-transport" 
    port = "9300" 
    } 

    zone = "us-central1-a" 
} 

resource "google_compute_forwarding_rule" "elasticsearch-forwarding-rule" { 
    name = "elasticsearch-lb" 
    load_balancing_scheme = "INTERNAL" 
    backend_service = "${google_compute_region_backend_service.elasticsearch-lb.self_link}" 
    ports = [ "9200", "9300" ] 
} 

resource "google_compute_region_backend_service" "elasticsearch-lb" { 
    name    = "elasticsearch-lb" 
    protocol   = "TCP" 
    timeout_sec  = 10 
    session_affinity = "NONE" 

    backend { 
    group = "${google_compute_instance_group.elasticsearch-cluster.self_link}" 
    } 

    health_checks = ["${google_compute_health_check.elasticsearch-healthcheck.self_link}"] 
} 

resource "google_compute_health_check" "elasticsearch-healthcheck" { 
    name    = "elasticsearch-healthcheck" 
    check_interval_sec = 5 
    timeout_sec  = 5 

    tcp_health_check { 
    port = "9200" 
    } 
} 
関連する問題