Skip to content

Commit be19081

Browse files
authored
docs: apply example formatting (#314)
- Applies HCL formatting. - Applies markdown formatting. Signed-off-by: Ryan Johnson <ryan.johnson@broadcom.com>
1 parent c5b480f commit be19081

File tree

24 files changed

+475
-424
lines changed

24 files changed

+475
-424
lines changed

examples/README.md

Lines changed: 75 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,84 +1,92 @@
1-
# Example: Creation of SDDC, public IP, cluster, site recovery and SRM node.
2-
3-
This is an example that demonstrates the creation of VMC resources like SDDC, cluster, public IP, site recovery and SRM node.
4-
5-
For site recovery activation, a 10-minute delay must be added after SDDC is created and before site recovery can be activated.
6-
7-
To add delay after SDDC has been created, update SDDC resource in [main.tf](https://github.com/vmware/terraform-provider-vmc/blob/master/examples/main.tf) with local-exec provisioner:
8-
9-
```sh
10-
resource "vmc_sddc" "sddc_1" {
11-
sddc_name = var.sddc_name
12-
vpc_cidr = var.vpc_cidr
13-
num_host = var.num_hosts
14-
provider_type = var.provider_type
15-
region = data.vmc_customer_subnets.my_subnets.region
16-
vxlan_subnet = var.vxlan_subnet
17-
delay_account_link = false
18-
skip_creating_vxlan = false
19-
sso_domain = "vmc.local"
20-
sddc_type = var.sddc_type
21-
deployment_type = "SingleAZ"
22-
23-
host_instance_type = var.host_instance_type
24-
25-
account_link_sddc_config {
26-
customer_subnet_ids = [data.vmc_customer_subnets.my_subnets.ids[0]]
27-
connected_account_id = data.vmc_connected_accounts.my_accounts.id
28-
}
29-
30-
timeouts {
31-
create = "300m"
32-
update = "300m"
33-
delete = "180m"
34-
}
35-
36-
# provisioner defined to add 10 minute delay after SDDC creation to enable site recovery activation.
37-
provisioner "local-exec" {
38-
command = "sleep 600"
39-
}
40-
}
41-
1+
# Example
2+
3+
## Creation of SDDC, Public IP, Cluster, Site Recovery, and SRM Node
4+
5+
This is an example that demonstrates the creation of VMC resources like SDDC,
6+
cluster, public IP, Site Recovery and SRM node.
7+
8+
For Site Recovery activation, a 10-minute delay must be added after SDDC is
9+
created and before Site Recovery can be activated.
10+
11+
To add delay after SDDC has been created, update SDDC resource in the
12+
[`main.tf`](https://github.com/vmware/terraform-provider-vmc/blob/main/examples/main.tf)
13+
with `local-exec` provisioner:
14+
15+
```hcl
16+
resource "vmc_sddc" "sddc_1" {
17+
sddc_name = var.sddc_name
18+
vpc_cidr = var.vpc_cidr
19+
num_host = var.num_hosts
20+
provider_type = var.provider_type
21+
region = data.vmc_customer_subnets.my_subnets.region
22+
vxlan_subnet = var.vxlan_subnet
23+
delay_account_link = false
24+
skip_creating_vxlan = false
25+
sso_domain = "vmc.local"
26+
sddc_type = var.sddc_type
27+
deployment_type = "SingleAZ"
28+
29+
host_instance_type = var.host_instance_type
30+
31+
account_link_sddc_config {
32+
customer_subnet_ids = [data.vmc_customer_subnets.my_subnets.ids[0]]
33+
connected_account_id = data.vmc_connected_accounts.my_accounts.id
34+
}
35+
36+
timeouts {
37+
create = "300m"
38+
update = "300m"
39+
delete = "180m"
40+
}
41+
42+
# provisioner defined to add 10 minute delay after SDDC creation to enable site recovery activation.
43+
provisioner "local-exec" {
44+
command = "sleep 600"
45+
}
46+
}
4247
```
4348

4449
To run the example:
4550

46-
* Generate an API token using [VMware Cloud on AWS console] (https://vmc.vmware.com/console/)
51+
* Generate an API token using [VMware Cloud on AWS console]
52+
(<https://vmc.vmware.com/console/>)
4753

48-
* Update the required parameters api_token and org_id in [variables.tf](https://github.com/vmware/terraform-provider-vmc/blob/master/examples/variables.tf) with your infrastructure settings.
49-
50-
* Load the provider
54+
* Update the required parameters `api_token` and `org_id` in the
55+
[`variables.tf`](https://github.com/vmware/terraform-provider-vmc/blob/main/examples/variables.tf)
56+
with your infrastructure settings.
5157

52-
```sh
53-
terraform init
54-
```
58+
* Load the provider:
5559

56-
* Execute the plan
60+
```sh
61+
terraform init
62+
```
5763

58-
```sh
59-
terraform apply
60-
```
64+
* Run the plan:
6165

62-
or
66+
```sh
67+
terraform apply
68+
```
6369

64-
```sh
65-
terraform apply -var="api_token=xxxx" -var="org_id=xxxx"
66-
```
70+
or
6771

68-
* Check the terraform state
72+
```sh
73+
terraform apply -var="api_token=xxxx" -var="org_id=xxxx"
74+
```
6975

70-
```sh
71-
terraform show
72-
```
76+
* Check the state:
77+
78+
```sh
79+
terraform show
80+
```
7381

7482
* Delete VMC resources created during apply.
7583

76-
```sh
77-
terraform destroy
78-
```
84+
```sh
85+
terraform destroy
86+
```
7987

80-
or
88+
or
8189

82-
```sh
83-
terraform destroy -var="api_token=xxxx" -var="org_id=xxxx"
84-
```
90+
```sh
91+
terraform destroy -var="api_token=xxxx" -var="org_id=xxxx"
92+
```

examples/cluster/README.md

Lines changed: 34 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,53 @@
1-
# Example: Cluster management for SDDC
1+
# Example
22

3-
This is an example that demonstrates cluster management actions like creating, updating and deleting a cluster for an SDDC.
3+
## Cluster Management for SDDC
4+
5+
This is an example that demonstrates cluster management actions like creating,
6+
updating, and deleting a cluster for an SDDC.
47

58
To run the example:
69

7-
* Generate an API token using [VMware Cloud on AWS console] (https://vmc.vmware.com/console/)
10+
* Generate an API token using
11+
[VMware Cloud on AWS console](https://vmc.vmware.com/console/).
812

9-
* Update the required parameters api_token and org_id in [variables.tf](https://github.com/vmware/terraform-provider-vmc/blob/master/examples/cluster/variables.tf) with your infrastructure settings.
13+
* Update the required parameters `api_token` and `org_id` in the
14+
[`variables.tf`](https://github.com/vmware/terraform-provider-vmc/blob/main/examples/cluster/variables.tf)
15+
with your infrastructure settings.
1016

11-
* Load the provider
17+
* Load the provider:
1218

13-
```sh
14-
terraform init
15-
```
19+
```sh
20+
terraform init
21+
```
1622

17-
* Execute the plan
23+
* Run the plan:
1824

19-
```sh
20-
terraform apply
21-
```
25+
```sh
26+
terraform apply
27+
```
2228

23-
or
29+
or
2430

25-
```sh
26-
terraform apply -var="api_token=xxxx" -var="org_id=xxxx"
27-
```
31+
```sh
32+
terraform apply -var="api_token=xxxx" -var="org_id=xxxx"
33+
```
2834

29-
Verify cluster has been created successfully.
35+
Verify cluster has been created successfully.
3036

31-
* Check the terraform state
37+
* Check the state:
3238

33-
```sh
34-
terraform show
35-
```
39+
```sh
40+
terraform show
41+
```
3642

3743
* Delete the cluster
3844

39-
```sh
40-
terraform destroy
41-
```
45+
```sh
46+
terraform destroy
47+
```
4248

43-
or
49+
or
4450

45-
```sh
46-
terraform destroy -var="api_token=xxxx" -var="org_id=xxxx"
47-
```
51+
```sh
52+
terraform destroy -var="api_token=xxxx" -var="org_id=xxxx"
53+
```

examples/cluster/main.tf

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ terraform {
77
}
88
provider "vmc" {
99
refresh_token = var.api_token
10-
org_id = var.org_id
10+
org_id = var.org_id
1111
}
1212

1313
# Empty data source defined in order to store the org display name and name in terraform state
@@ -33,7 +33,7 @@ resource "vmc_sddc" "sddc_1" {
3333
delay_account_link = false
3434
skip_creating_vxlan = false
3535
sso_domain = "vmc.local"
36-
deployment_type = "SingleAZ"
36+
deployment_type = "SingleAZ"
3737

3838
host_instance_type = var.host_instance_type
3939

@@ -49,10 +49,10 @@ resource "vmc_sddc" "sddc_1" {
4949
}
5050

5151
resource "vmc_cluster" "cluster_1" {
52-
sddc_id = vmc_sddc.sddc_1.id
52+
sddc_id = vmc_sddc.sddc_1.id
5353
num_hosts = var.cluster_num_hosts
5454
microsoft_licensing_config {
55-
mssql_licensing = "DISABLED"
56-
windows_licensing = "ENABLED"
57-
}
55+
mssql_licensing = "DISABLED"
56+
windows_licensing = "ENABLED"
57+
}
5858
}

examples/cluster/variables.tf

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
variable "api_token" {
22
description = "API token used to authenticate when calling the VMware Cloud Services API."
3-
default = ""
3+
default = ""
44
}
55

66
variable "org_id" {
77
description = "Organization Identifier."
8-
default = ""
8+
default = ""
99
}
1010

1111
variable "aws_account_number" {
1212
description = "The AWS account number."
1313
default = ""
1414
}
1515

16-
variable "sddc_name"{
16+
variable "sddc_name" {
1717
description = "Name of SDDC."
18-
default = "sddc-test"
18+
default = "sddc-test"
1919
}
2020

2121
variable "sddc_region" {
22-
description = "The AWS or VMC specific region."
22+
description = "The AWS or VMC specific region."
2323
default = "us-west-2"
2424
}
2525

@@ -33,22 +33,22 @@ variable "vxlan_subnet" {
3333
default = ""
3434
}
3535

36-
variable provider_type {
36+
variable "provider_type" {
3737
description = "Determines what additional properties are available based on cloud provider. Default value : AWS"
3838
default = "AWS"
3939
}
4040

41-
variable host_instance_type {
41+
variable "host_instance_type" {
4242
description = "The instance type for the ESX hosts in the primary cluster of the SDDC. Possible values: I3_METAL, I4I_METAL"
4343
default = ""
4444
}
4545

46-
variable cluster_num_hosts {
46+
variable "cluster_num_hosts" {
4747
description = "The number of hosts in the (secondary) cluster."
48-
default = 3
48+
default = 3
4949
}
5050

51-
variable sddc_primary_cluster_num_hosts {
51+
variable "sddc_primary_cluster_num_hosts" {
5252
description = "The number of hosts in the primary cluster of the SDDC."
5353
default = 3
54-
}
54+
}

examples/main.tf

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ terraform {
66
}
77
}
88
provider "vmc" {
9-
client_id = var.client_id
9+
client_id = var.client_id
1010
client_secret = var.client_secret
11-
org_id = var.org_id
11+
org_id = var.org_id
1212
}
1313
# Empty data source defined in order to store the org display name and name in terraform state
1414
data "vmc_org" "my_org" {
@@ -33,8 +33,8 @@ resource "vmc_sddc" "sddc_1" {
3333
delay_account_link = false
3434
skip_creating_vxlan = false
3535
sso_domain = "vmc.local"
36-
sddc_type = var.sddc_type
37-
deployment_type = "SingleAZ"
36+
sddc_type = var.sddc_type
37+
deployment_type = "SingleAZ"
3838

3939
host_instance_type = var.host_instance_type
4040

@@ -50,22 +50,22 @@ resource "vmc_sddc" "sddc_1" {
5050
}
5151

5252
resource "vmc_cluster" "cluster_1" {
53-
sddc_id = vmc_sddc.sddc_1.id
53+
sddc_id = vmc_sddc.sddc_1.id
5454
num_hosts = var.cluster_num_hosts
5555
}
5656

5757
resource "vmc_public_ip" "public_ip_1" {
5858
nsxt_reverse_proxy_url = vmc_sddc.sddc_1.nsxt_reverse_proxy_url
59-
display_name = var.public_ip_displayname
59+
display_name = var.public_ip_displayname
6060
}
6161

6262
resource "vmc_site_recovery" "site_recovery_1" {
63-
sddc_id = vmc_sddc.sddc_1.id
63+
sddc_id = vmc_sddc.sddc_1.id
6464
srm_extension_key_suffix = var.site_recovery_srm_extension_key_suffix
6565
}
6666

67-
resource "vmc_srm_node" "srm_node_1"{
68-
sddc_id = vmc_sddc.sddc_1.id
67+
resource "vmc_srm_node" "srm_node_1" {
68+
sddc_id = vmc_sddc.sddc_1.id
6969
srm_node_extension_key_suffix = var.srm_node_srm_extension_key_suffix
70-
depends_on = [vmc_site_recovery.site_recovery_1]
70+
depends_on = [vmc_site_recovery.site_recovery_1]
7171
}

0 commit comments

Comments
 (0)