Skip to content

Commit

Permalink
Make 'firewall_id' required in 'civo_kubernetes_cluster' resource (#100)
Browse files Browse the repository at this point in the history
  • Loading branch information
zulh-civo committed Sep 30, 2021
1 parent 14e7970 commit 13d4a67
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 3 deletions.
3 changes: 1 addition & 2 deletions civo/resource_kubernetes_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ func resourceKubernetesCluster() *schema.Resource {
},
"firewall_id": {
Type: schema.TypeString,
Optional: true,
Computed: true,
Required: true,
Description: "The existing firewall ID to use for this cluster",
},
// Computed resource
Expand Down
22 changes: 21 additions & 1 deletion docs/resources/kubernetes_cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,42 @@ data "civo_instances_size" "xsmall" {
}
}
# Create a firewall
resource "civo_firewall" "my-firewall" {
name = "my-firewall"
}
# Create a firewall rule
resource "civo_firewall_rule" "kubernetes" {
firewall_id = civo_firewall.my-firewall.id
protocol = "tcp"
start_port = "6443"
end_port = "6443"
cidr = ["0.0.0.0/0"]
direction = "ingress"
label = "kubernetes-api-server"
}
# Create a cluster
resource "civo_kubernetes_cluster" "my-cluster" {
name = "my-cluster"
applications = "Portainer,Linkerd:Linkerd & Jaeger"
num_target_nodes = 2
target_nodes_size = element(data.civo_instances_size.xsmall.sizes, 0).name
firewall_id = civo_firewall.my-firewall.id
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- **firewall_id** (String) The existing firewall ID to use for this cluster

### Optional

- **applications** (String) Comma separated list of applications to install. Spaces within application names are fine, but shouldn't be either side of the comma. Application names are case-sensitive; the available applications can be listed with the Civo CLI: 'civo kubernetes applications ls'. If you want to remove a default installed application, prefix it with a '-', e.g. -Traefik. For application that supports plans, you can use 'app_name:app_plan' format e.g. 'Linkerd:Linkerd & Jaeger' or 'MariaDB:5GB'.
- **firewall_id** (String) The existing firewall ID to use for this cluster
- **kubernetes_version** (String) The version of k3s to install (optional, the default is currently the latest available)
- **name** (String) Name for your cluster, must be unique within your account
- **network_id** (String) The network for the cluster, if not declare we use the default one
Expand Down
17 changes: 17 additions & 0 deletions examples/resources/civo_kubernetes_cluster/resource.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,27 @@ data "civo_instances_size" "xsmall" {
}
}

# Create a firewall
resource "civo_firewall" "my-firewall" {
name = "my-firewall"
}

# Create a firewall rule
resource "civo_firewall_rule" "kubernetes" {
firewall_id = civo_firewall.my-firewall.id
protocol = "tcp"
start_port = "6443"
end_port = "6443"
cidr = ["0.0.0.0/0"]
direction = "ingress"
label = "kubernetes-api-server"
}

# Create a cluster
resource "civo_kubernetes_cluster" "my-cluster" {
name = "my-cluster"
applications = "Portainer,Linkerd:Linkerd & Jaeger"
num_target_nodes = 2
target_nodes_size = element(data.civo_instances_size.xsmall.sizes, 0).name
firewall_id = civo_firewall.my-firewall.id
}

0 comments on commit 13d4a67

Please sign in to comment.