-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmagnum-cluster.tf
More file actions
72 lines (60 loc) · 1.97 KB
/
Copy pathmagnum-cluster.tf
File metadata and controls
72 lines (60 loc) · 1.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# Magnum Cluster Terraform Configuration
# OpenStack provider configuration
provider "openstack" {
# Authentication can be provided via environment variables:
# OS_AUTH_URL, OS_USERNAME, OS_PASSWORD, OS_TENANT_NAME, OS_REGION_NAME
# or via application credentials:
# OS_APPLICATION_CREDENTIAL_ID, OS_APPLICATION_CREDENTIAL_SECRET
}
terraform {
required_version = ">= 0.14.2"
required_providers {
openstack = {
source = "terraform-provider-openstack/openstack"
version = "3.4.0"
}
}
}
# Create the Magnum cluster
resource "openstack_containerinfra_cluster_v1" "cluster" {
name = var.cluster_name
cluster_template_id = var.template_id
master_count = var.master_count
master_flavor = var.master_flavor
node_count = var.node_count
flavor = var.flavor
docker_volume_size = 20
fixed_network = "0d5ac169-fd1c-4437-9adf-8a6445efc15e"
fixed_subnet = "bb2065cd-b3d7-48d5-a592-9b39a75ab339"
labels = {
auto_scaling_enabled = "true"
min_node_count = 1
max_node_count = 5
}
}
# Output cluster information
output "cluster_id" {
description = "ID of the created cluster"
value = openstack_containerinfra_cluster_v1.cluster.id
}
output "cluster_name" {
description = "Name of the created cluster"
value = openstack_containerinfra_cluster_v1.cluster.name
}
output "api_address" {
description = "API endpoint of the cluster"
value = openstack_containerinfra_cluster_v1.cluster.api_address
}
output "master_addresses" {
description = "Addresses of master nodes"
value = openstack_containerinfra_cluster_v1.cluster.master_addresses
}
output "node_addresses" {
description = "Addresses of worker nodes"
value = openstack_containerinfra_cluster_v1.cluster.node_addresses
}
output "kubeconfig" {
description = "Path to kubeconfig file"
value = openstack_containerinfra_cluster_v1.cluster.kubeconfig
sensitive = true
}