Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added example and description for stretched clusters. #38

Merged
merged 4 commits into from
Jun 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions examples/stretched_cluster/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Example: Deploy a MultiAZ SDDC for stretched cluster

This is an example that demonstrates MultiAZ SDDC management actions like creating, updating and deleting an existing SDDC.

# Stretched Clusters

The Stretched Clusters feature deploys a single SDDC across two AWS availability zones.
This option is only available during the SDDC creation. When enabled the default number of ESXi hosts supported in a Stretched Cluster is six.
Additional hosts can be added later but must be done in pairs across AWS availability zones. The Stretched Clusters feature requires an AWS VPC with two subnets, one subnet per availability zone. The subnets determine an ESXi host placement between the two availability zones.

To run the example:

* Generate an API token using [VMware Cloud on AWS console] (https://vmc.vmware.com/console/)

* Update the required parameters api_token and org_id in [variables.tf](https://github.com/terraform-providers/terraform-provider-vmc/blob/master/examples/sddc/variables.tf) with your infrastructure settings.

* Load the provider

```sh
terraform init
```

* Execute the plan

```sh
terraform apply
```

or

```sh
terraform apply -var="api_token=xxxx" -var="org_id=xxxx"
```

Verify the SDDC has been created successfully.

* Check the terraform state

```sh
terraform show
```

* Delete the SDDC

```sh
terraform destroy
```

or

```sh
terraform destroy -var="api_token=xxxx" -var="org_id=xxxx"
```
41 changes: 41 additions & 0 deletions examples/stretched_cluster/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
provider "vmc" {
refresh_token = var.api_token
org_id = var.org_id
}
# Empty data source defined in order to store the org display name and name in terraform state
data "vmc_org" "my_org" {
}

data "vmc_connected_accounts" "my_accounts" {
account_number = var.aws_account_number
}

data "vmc_customer_subnets" "my_subnets" {
connected_account_id = data.vmc_connected_accounts.my_accounts.id
region = replace(upper(var.sddc_region), "-", "_")
}

resource "vmc_sddc" "sddc_1" {
sddc_name = var.sddc_name
vpc_cidr = var.vpc_cidr
num_host = var.sddc_num_hosts
provider_type = var.provider_type
region = data.vmc_customer_subnets.my_subnets.region
vxlan_subnet = var.vxlan_subnet
delay_account_link = false
skip_creating_vxlan = false
sso_domain = "vmc.local"

deployment_type = var.deployment_type
host_instance_type = var.host_instance_type

account_link_sddc_config {
customer_subnet_ids = [data.vmc_customer_subnets.my_subnets.ids[0],data.vmc_customer_subnets.my_subnets.ids[1]]
connected_account_id = data.vmc_connected_accounts.my_accounts.id
}
timeouts {
create = "300m"
update = "300m"
delete = "180m"
}
}
61 changes: 61 additions & 0 deletions examples/stretched_cluster/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
variable "api_token" {
description = "API token used to authenticate when calling the VMware Cloud Services API."
default = ""
}

variable "org_id" {
description = "Organization Identifier."
default = ""
}

variable "aws_account_number" {
description = "The AWS account number."
default = ""
}

variable "sddc_name"{
description = "Name of SDDC."
default = "sddc-test"
}

variable "sddc_region" {
description = "The AWS or VMC specific region."
default = "us-west-2"
}

variable "vpc_cidr" {
description = "SDDC management network CIDR. Only prefix of 16, 20 and 23 are supported."
default = ""
}

variable "vxlan_subnet" {
description = "A logical network segment that will be created with the SDDC under the compute gateway."
default = ""
}

variable host_instance_type {
description = "The instance type for the ESX hosts in the primary cluster of the SDDC. Possible values: I3_METAL, R5_METAL."
default = ""
}

variable storage_capacity {
description = "The storage capacity value to be requested for the SDDC primary cluster. This variable is only for R5.METAL. Possible values are 15TB, 20TB, 25TB, 30TB, 35TB per host."
default = ""
}

variable sddc_num_hosts {
description = "The number of hosts in SDDC."
default = 6
}

variable provider_type {
description = "Determines what additional properties are available based on cloud provider. Default value : AWS"
default = "AWS"
}

variable deployment_type {
description = "Deployment type for stretched cluster."
default = "MultiAZ"
}