Skip to content

Commit

Permalink
Merge pull request #58 from Mirantis/adapt-azure-for-yamlencode
Browse files Browse the repository at this point in the history
Adapt Azure TF example to use yamlencode
  • Loading branch information
kke authored Nov 4, 2020
2 parents 9068d7e + a198ba5 commit adac5d6
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 16 deletions.
6 changes: 3 additions & 3 deletions examples/terraform/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
Working examples for using Terraform with Mirantis Launchpad. The scripts are provided as examples; you can change them to fit your specific configuration requirements or create your own.


* [AWS](aws/README.md), a complete infrastructure example including VPC, LB, security groups, and other settings.

* [AWS](aws/README.md), a complete infrastructure example including VPC, LB, security groups, and other settings.
* [Azure](azure/README.md), a complete example including VNET, LB, network security rules, and other settings.
* [Hetzner](hetzner/README.md), a simple example with just a couple of VMs provisioned for a UCP cluster.

* [OpenStack](openstack/README.md), a simple example with basic settings.
* [VMware](vmware/README.md), a simple example using existing vSphere network.
1 change: 0 additions & 1 deletion examples/terraform/aws/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ This directory provides an example flow for using Mirantis Launchpad with Terraf

* An account and credentials for AWS.
* Terraform [installed](https://learn.hashicorp.com/terraform/getting-started/install)
* [yq installed](https://github.com/mikefarah/yq#install)

## Steps

Expand Down
3 changes: 1 addition & 2 deletions examples/terraform/azure/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@ This directory provides an example flow for using Mirantis Launchpad with Terraf

* An account and credentials for Azure.
* Terraform [installed](https://learn.hashicorp.com/terraform/getting-started/install)
* [yq installed](https://github.com/mikefarah/yq#install)

## Steps

1. Create terraform.tfvars file with needed details. You can use the provided terraform.tfvars.example as a baseline.
2. `terraform init`
3. `terraform apply`
4. `terraform output -json | yq r --prettyPrint - ucp_cluster.value > launchpad.yaml`
4. `terraform output ucp_cluster > launchpad.yaml`
5. `launchpad apply`

## Notes
Expand Down
8 changes: 6 additions & 2 deletions examples/terraform/azure/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ locals {
]
}

output "ucp_cluster" {
value = {
locals {
launchpad_tmpl = {
apiVersion = "launchpad.mirantis.com/v1"
kind = "DockerEnterprise"
metadata = {
Expand All @@ -132,6 +132,10 @@ output "ucp_cluster" {
}
}

output "ucp_cluster" {
value = yamlencode(local.launchpad_tmpl)
}

output "loadbalancers" {
value = {
MasterLB = module.masters.lb_dns_name
Expand Down
8 changes: 4 additions & 4 deletions examples/terraform/azure/terraform.tfvars.example
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cluster_name = "my-ucp-cluster"
master_count = 1
worker_count = 3
cluster_name = "my-ucp-cluster"
master_count = 1
worker_count = 3
windows_worker_count = 0
admin_password = "orcaorcaorca"
admin_password = "orcaorcaorca"
1 change: 0 additions & 1 deletion examples/terraform/hetzner/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ This directory provides an example flow with Mirantis Launchpad tool together wi

* You need an account and API token for Hetzner
* Terraform [installed](https://learn.hashicorp.com/terraform/getting-started/install)
* [yq installed](https://github.com/mikefarah/yq#install)

## Steps

Expand Down
3 changes: 1 addition & 2 deletions examples/terraform/openstack/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,14 @@ This directory provides an example flow with Mirantis Launchpad together with Te

* You need an account and credentials for an OpenStack Tenant.
* Terraform [installed](https://learn.hashicorp.com/terraform/getting-started/install)
* [yq installed](https://github.com/mikefarah/yq#install)
* [Generate SSH key](https://help.github.com/en/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent#generating-a-new-ssh-key)

## Steps

1. Create terraform.tfvars file with needed details. You can use the provided terraform.tfvars.example as a baseline.
2. `terraform init`
3. Create SSH key and configure path
4. Create Cloud Provider config file and configure path
4. Create Cloud Provider config file and configure path
5. Configure .tfvars file with all necessary parameters
6. `terraform apply`
7. `terraform output ucp_cluster > launchpad.yaml`
Expand Down
1 change: 0 additions & 1 deletion examples/terraform/vmware/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ This directory provides an example flow with Mirantis Launchpad tool together wi

* You need VMware vSphere credentials for API operations
* Terraform [installed](https://learn.hashicorp.com/terraform/getting-started/install)
* [yq installed](https://github.com/mikefarah/yq#install)

## Steps

Expand Down

0 comments on commit adac5d6

Please sign in to comment.