Usage with Terraform

Pharos Cluster can read information from Terraform json output. In this scenario cluster.yml contents can be partially read from Terraform json output.

Terraform output json integration can be enabled with --tf-json option, for example:

$ pharos-cluster up -c cluster.yml --tf-json tf.json

Setting Hosts

hosts array in Kontena Pharos cluster.yml can be set via pharos_hosts output.

For example:

output "pharos_hosts" {
  value = {
    masters = {
      address         = "${aws_instance.pharos_master.*.public_ip}"
      private_address = "${aws_instance.pharos_master.*.private_ip}"
      role            = "master"
      user            = "ubuntu"
    }

    workers = {
      address         = "${aws_instance.pharos_worker.*.public_ip}"
      private_address = "${aws_instance.pharos_worker.*.private_ip}"
      role            = "worker"
      user            = "ubuntu"

      label = {
        ingress = "nginx"
      }
    }
  }
}

is equal to:

hosts:
    - address: "..."
      private_address: "..."
      role: "master"
      user: "ubuntu"
    - address: "..."
      private_address: "..."
      role: "worker"
      user: "ubuntu"
      label:
        ingress: "nginx"

in cluster.yml.

Setting Addons

It's possible to set addon values in Kontena Pharos cluster.yml via pharos_addons output.

For example:

output "pharos_addons" {
  value = {
    my-addon = {
      enabled = true
      region = "eu-west-1"
    }
  }
}

is equal to:

addons:
  my-addon:
    enabled: true
    region: "eu-west-1"

in cluster.yml.

Setting API Endpoint

api.endpoint in Kontena Pharos cluster.yml can be set via pharos_api output.

For example:

output "pharos_api" {
  value = {
    endpoint = "my.kubernetes-api.com"
  }
}

is equal to:

api:
  endpoint: "my.kubernetes-api.com"

in cluster.yml.

Full Examples

results matching ""

    No results matching ""