Skip to content

Commit e0304c6

Browse files
Templates and example files added
Splitting cluster examples and adding templates for doc generation Signed-off-by: Vasundhara Shukla <vasundharas@vmware.com>
1 parent 7590ca3 commit e0304c6

23 files changed

+1543
-320
lines changed

examples/resources/tmc_cluster/resource.tf

-215
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Create TMC attach cluster entry
2+
resource "tmc_cluster" "attach_cluster_without_apply" {
3+
management_cluster_name = "attached" # Default: attached
4+
provisioner_name = "attached" # Default: attached
5+
name = "terraform-attach" # Required
6+
7+
meta {
8+
description = "create attach cluster from terraform"
9+
labels = { "key" : "value" }
10+
}
11+
12+
spec {
13+
cluster_group = "default" # Default: default
14+
}
15+
16+
wait_until_ready = false
17+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Create TMC attach cluster with k8s cluster kubeconfig provided
2+
# The provider would create the cluster entry and apply the deployment link manifests on to the k8s kubeconfig provided.
3+
resource "tmc_cluster" "attach_cluster_with_kubeconfig" {
4+
management_cluster_name = "attached" # Default: attached
5+
provisioner_name = "attached" # Default: attached
6+
name = "demo-cluster" # Required
7+
8+
attach_k8s_cluster {
9+
kubeconfig_file = "<kube-config path>" # Required
10+
description = "optional description about the kube-config provided"
11+
}
12+
13+
meta {
14+
description = "description of the cluster"
15+
labels = { "key" : "value" }
16+
}
17+
18+
spec {
19+
cluster_group = "default" # Default: default
20+
}
21+
22+
wait_until_ready = true # Default: false, when set resource waits until 3 min for the cluster to become ready
23+
24+
# The deployment link and the command needed to be run to attach this cluster would be provided in the output.status.execution_cmd
25+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Create TMC attach cluster entry with proxy
2+
resource "tmc_cluster" "attach_cluster_with_proxy" {
3+
management_cluster_name = "attached" # Default: attached
4+
provisioner_name = "attached" # Default: attached
5+
name = "terraform-attach-proxy" # Required
6+
7+
meta {
8+
description = "create attach cluster from terraform"
9+
labels = { "key" : "value" }
10+
}
11+
12+
spec {
13+
cluster_group = "default" # Default: default
14+
proxy = "proxy-name"
15+
}
16+
17+
wait_until_ready = false
18+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# Create a TKGm Vsphere workload cluster entry
2+
resource "tmc_cluster" "create_tkg_vsphere_cluster" {
3+
management_cluster_name = "tkgm-terraform"
4+
provisioner_name = "default"
5+
name = "tkgm-workload-test"
6+
7+
meta {
8+
description = "description of the cluster"
9+
labels = { "key" : "value" }
10+
}
11+
12+
spec {
13+
cluster_group = "default" # Default: default
14+
tkg_vsphere {
15+
settings {
16+
network {
17+
pods {
18+
cidr_blocks = [
19+
"172.20.0.0/16",
20+
]
21+
}
22+
23+
services {
24+
cidr_blocks = [
25+
"10.96.0.0/16",
26+
]
27+
}
28+
29+
control_plane_end_point = "10.191.249.39"
30+
}
31+
32+
security {
33+
ssh_key = "default"
34+
}
35+
}
36+
37+
distribution {
38+
version = "v1.20.5+vmware.2-tkg.1"
39+
40+
workspace {
41+
datacenter = "/dc0"
42+
datastore = "/dc0/datastore/local-0"
43+
workspace_network = "/dc0/network/Avi Internal"
44+
folder = "/dc0/vm"
45+
resource_pool = "/dc0/host/cluster0/Resources"
46+
}
47+
}
48+
49+
topology {
50+
control_plane {
51+
vm_config {
52+
cpu = "2"
53+
disk_size = "20"
54+
memory = "4096"
55+
}
56+
57+
high_availability = false
58+
}
59+
60+
node_pools {
61+
spec {
62+
worker_node_count = "1"
63+
cloud_label = {
64+
"key1" : "val1"
65+
}
66+
node_label = {
67+
"key2" : "val2"
68+
}
69+
70+
tkg_vsphere {
71+
vm_config {
72+
cpu = "2"
73+
disk_size = "40"
74+
memory = "4096"
75+
}
76+
}
77+
}
78+
79+
info {
80+
name = "default-nodepool"
81+
description = "my nodepool"
82+
}
83+
}
84+
}
85+
}
86+
}
87+
}

0 commit comments

Comments
 (0)