mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-08-09 07:22:40 -04:00
terraform: instance_count => initial_count (#1989)
Normalize naming for the "instance_count" / "initial_count" int terraform to always use "initial_count". This is required, since there is a naming confusion on AWS. "initial_count" is more precise, since it reflects the fact that this value is ignored when applying the terraform template after the scaling groups already exist.
This commit is contained in:
parent
00ee11084e
commit
5f8ea1348a
19 changed files with 82 additions and 82 deletions
|
@ -228,7 +228,7 @@ func (c *Creator) createAzure(ctx context.Context, cl terraformClient, opts Crea
|
||||||
NodeGroups: map[string]terraform.AzureNodeGroup{
|
NodeGroups: map[string]terraform.AzureNodeGroup{
|
||||||
"control_plane_default": {
|
"control_plane_default": {
|
||||||
Role: role.ControlPlane.TFString(),
|
Role: role.ControlPlane.TFString(),
|
||||||
InstanceCount: toPtr(opts.ControlPlaneCount),
|
InitialCount: toPtr(opts.ControlPlaneCount),
|
||||||
InstanceType: opts.InsType,
|
InstanceType: opts.InsType,
|
||||||
DiskSizeGB: opts.Config.StateDiskSizeGB,
|
DiskSizeGB: opts.Config.StateDiskSizeGB,
|
||||||
DiskType: opts.Config.Provider.Azure.StateDiskType,
|
DiskType: opts.Config.Provider.Azure.StateDiskType,
|
||||||
|
@ -236,7 +236,7 @@ func (c *Creator) createAzure(ctx context.Context, cl terraformClient, opts Crea
|
||||||
},
|
},
|
||||||
"worker_default": {
|
"worker_default": {
|
||||||
Role: role.Worker.TFString(),
|
Role: role.Worker.TFString(),
|
||||||
InstanceCount: toPtr(opts.WorkerCount),
|
InitialCount: toPtr(opts.WorkerCount),
|
||||||
InstanceType: opts.InsType,
|
InstanceType: opts.InsType,
|
||||||
DiskSizeGB: opts.Config.StateDiskSizeGB,
|
DiskSizeGB: opts.Config.StateDiskSizeGB,
|
||||||
DiskType: opts.Config.Provider.Azure.StateDiskType,
|
DiskType: opts.Config.Provider.Azure.StateDiskType,
|
||||||
|
@ -428,14 +428,14 @@ func (c *Creator) createQEMU(ctx context.Context, cl terraformClient, lv libvirt
|
||||||
NodeGroups: map[string]terraform.QEMUNodeGroup{
|
NodeGroups: map[string]terraform.QEMUNodeGroup{
|
||||||
"control_plane_default": {
|
"control_plane_default": {
|
||||||
Role: role.ControlPlane.TFString(),
|
Role: role.ControlPlane.TFString(),
|
||||||
InstanceCount: opts.ControlPlaneCount,
|
InitialCount: opts.ControlPlaneCount,
|
||||||
DiskSize: opts.Config.StateDiskSizeGB,
|
DiskSize: opts.Config.StateDiskSizeGB,
|
||||||
CPUCount: opts.Config.Provider.QEMU.VCPUs,
|
CPUCount: opts.Config.Provider.QEMU.VCPUs,
|
||||||
MemorySize: opts.Config.Provider.QEMU.Memory,
|
MemorySize: opts.Config.Provider.QEMU.Memory,
|
||||||
},
|
},
|
||||||
"worker_default": {
|
"worker_default": {
|
||||||
Role: role.Worker.TFString(),
|
Role: role.Worker.TFString(),
|
||||||
InstanceCount: opts.WorkerCount,
|
InitialCount: opts.WorkerCount,
|
||||||
DiskSize: opts.Config.StateDiskSizeGB,
|
DiskSize: opts.Config.StateDiskSizeGB,
|
||||||
CPUCount: opts.Config.Provider.QEMU.VCPUs,
|
CPUCount: opts.Config.Provider.QEMU.VCPUs,
|
||||||
MemorySize: opts.Config.Provider.QEMU.Memory,
|
MemorySize: opts.Config.Provider.QEMU.Memory,
|
||||||
|
|
|
@ -254,7 +254,7 @@ module "instance_group" {
|
||||||
zone = each.value.zone
|
zone = each.value.zone
|
||||||
uid = local.uid
|
uid = local.uid
|
||||||
instance_type = each.value.instance_type
|
instance_type = each.value.instance_type
|
||||||
instance_count = each.value.instance_count
|
initial_count = each.value.initial_count
|
||||||
image_id = var.ami
|
image_id = var.ami
|
||||||
state_disk_type = each.value.disk_type
|
state_disk_type = each.value.disk_type
|
||||||
state_disk_size = each.value.disk_size
|
state_disk_size = each.value.disk_size
|
||||||
|
|
|
@ -71,7 +71,7 @@ resource "aws_autoscaling_group" "autoscaling_group" {
|
||||||
}
|
}
|
||||||
min_size = 1
|
min_size = 1
|
||||||
max_size = 10
|
max_size = 10
|
||||||
desired_capacity = var.instance_count
|
desired_capacity = var.initial_count
|
||||||
vpc_zone_identifier = [var.subnetwork]
|
vpc_zone_identifier = [var.subnetwork]
|
||||||
target_group_arns = var.target_group_arns
|
target_group_arns = var.target_group_arns
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ variable "instance_type" {
|
||||||
description = "Instance type for the nodes."
|
description = "Instance type for the nodes."
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "instance_count" {
|
variable "initial_count" {
|
||||||
type = number
|
type = number
|
||||||
description = "Number of instances in the instance group."
|
description = "Number of instances in the instance group."
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ variable "name" {
|
||||||
variable "node_groups" {
|
variable "node_groups" {
|
||||||
type = map(object({
|
type = map(object({
|
||||||
role = string
|
role = string
|
||||||
instance_count = optional(number)
|
initial_count = optional(number)
|
||||||
instance_type = string
|
instance_type = string
|
||||||
disk_size = number
|
disk_size = number
|
||||||
disk_type = string
|
disk_type = string
|
||||||
|
|
|
@ -234,7 +234,7 @@ module "scale_set_group" {
|
||||||
{ constellation-maa-url = var.create_maa ? azurerm_attestation_provider.attestation_provider[0].attestation_uri : "" },
|
{ constellation-maa-url = var.create_maa ? azurerm_attestation_provider.attestation_provider[0].attestation_uri : "" },
|
||||||
)
|
)
|
||||||
|
|
||||||
instance_count = each.value.instance_count
|
initial_count = each.value.initial_count
|
||||||
state_disk_size = each.value.disk_size
|
state_disk_size = each.value.disk_size
|
||||||
state_disk_type = each.value.disk_type
|
state_disk_type = each.value.disk_type
|
||||||
location = var.location
|
location = var.location
|
||||||
|
|
|
@ -37,7 +37,7 @@ resource "azurerm_linux_virtual_machine_scale_set" "scale_set" {
|
||||||
resource_group_name = var.resource_group
|
resource_group_name = var.resource_group
|
||||||
location = var.location
|
location = var.location
|
||||||
sku = var.instance_type
|
sku = var.instance_type
|
||||||
instances = var.instance_count
|
instances = var.initial_count
|
||||||
admin_username = "adminuser"
|
admin_username = "adminuser"
|
||||||
admin_password = random_password.password.result
|
admin_password = random_password.password.result
|
||||||
overprovision = false
|
overprovision = false
|
||||||
|
|
|
@ -28,7 +28,7 @@ variable "zones" {
|
||||||
default = null
|
default = null
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "instance_count" {
|
variable "initial_count" {
|
||||||
type = number
|
type = number
|
||||||
description = "The number of instances in this scale set."
|
description = "The number of instances in this scale set."
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ variable "name" {
|
||||||
variable "node_groups" {
|
variable "node_groups" {
|
||||||
type = map(object({
|
type = map(object({
|
||||||
role = string
|
role = string
|
||||||
instance_count = optional(number)
|
initial_count = optional(number)
|
||||||
instance_type = string
|
instance_type = string
|
||||||
disk_size = number
|
disk_size = number
|
||||||
disk_type = string
|
disk_type = string
|
||||||
|
|
|
@ -158,7 +158,7 @@ module "instance_group" {
|
||||||
zone = each.value.zone
|
zone = each.value.zone
|
||||||
uid = local.uid
|
uid = local.uid
|
||||||
instance_type = each.value.instance_type
|
instance_type = each.value.instance_type
|
||||||
instance_count = each.value.initial_count
|
initial_count = each.value.initial_count
|
||||||
image_id = var.image_id
|
image_id = var.image_id
|
||||||
disk_size = each.value.disk_size
|
disk_size = each.value.disk_size
|
||||||
disk_type = each.value.disk_type
|
disk_type = each.value.disk_type
|
||||||
|
|
|
@ -112,7 +112,7 @@ resource "google_compute_instance_group_manager" "instance_group_manager" {
|
||||||
description = "Instance group manager for Constellation"
|
description = "Instance group manager for Constellation"
|
||||||
base_instance_name = local.name
|
base_instance_name = local.name
|
||||||
zone = var.zone
|
zone = var.zone
|
||||||
target_size = var.instance_count
|
target_size = var.initial_count
|
||||||
|
|
||||||
dynamic "stateful_disk" {
|
dynamic "stateful_disk" {
|
||||||
for_each = var.role == "control-plane" ? [1] : []
|
for_each = var.role == "control-plane" ? [1] : []
|
||||||
|
|
|
@ -33,7 +33,7 @@ variable "instance_type" {
|
||||||
description = "Instance type for the nodes."
|
description = "Instance type for the nodes."
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "instance_count" {
|
variable "initial_count" {
|
||||||
type = number
|
type = number
|
||||||
description = "Number of instances in the instance group."
|
description = "Number of instances in the instance group."
|
||||||
}
|
}
|
||||||
|
|
|
@ -162,7 +162,7 @@ module "instance_group_control_plane" {
|
||||||
source = "./modules/instance_group"
|
source = "./modules/instance_group"
|
||||||
name = local.name
|
name = local.name
|
||||||
role = "control-plane"
|
role = "control-plane"
|
||||||
instance_count = var.control_plane_count
|
initial_count = var.control_plane_count
|
||||||
image_id = openstack_images_image_v2.constellation_os_image.image_id
|
image_id = openstack_images_image_v2.constellation_os_image.image_id
|
||||||
flavor_id = var.flavor_id
|
flavor_id = var.flavor_id
|
||||||
security_groups = [openstack_compute_secgroup_v2.vpc_secgroup.id]
|
security_groups = [openstack_compute_secgroup_v2.vpc_secgroup.id]
|
||||||
|
@ -183,7 +183,7 @@ module "instance_group_worker" {
|
||||||
source = "./modules/instance_group"
|
source = "./modules/instance_group"
|
||||||
name = local.name
|
name = local.name
|
||||||
role = "worker"
|
role = "worker"
|
||||||
instance_count = var.worker_count
|
initial_count = var.worker_count
|
||||||
image_id = openstack_images_image_v2.constellation_os_image.image_id
|
image_id = openstack_images_image_v2.constellation_os_image.image_id
|
||||||
flavor_id = var.flavor_id
|
flavor_id = var.flavor_id
|
||||||
tags = local.tags
|
tags = local.tags
|
||||||
|
|
|
@ -20,7 +20,7 @@ locals {
|
||||||
|
|
||||||
resource "openstack_compute_instance_v2" "instance_group_member" {
|
resource "openstack_compute_instance_v2" "instance_group_member" {
|
||||||
name = "${local.name}-${count.index}"
|
name = "${local.name}-${count.index}"
|
||||||
count = var.instance_count
|
count = var.initial_count
|
||||||
image_id = var.image_id
|
image_id = var.image_id
|
||||||
flavor_id = var.flavor_id
|
flavor_id = var.flavor_id
|
||||||
security_groups = var.security_groups
|
security_groups = var.security_groups
|
||||||
|
|
|
@ -17,7 +17,7 @@ variable "role" {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "instance_count" {
|
variable "initial_count" {
|
||||||
type = number
|
type = number
|
||||||
description = "Number of instances in the instance group."
|
description = "Number of instances in the instance group."
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,7 @@ module "node_group" {
|
||||||
for_each = var.node_groups
|
for_each = var.node_groups
|
||||||
node_group_name = each.key
|
node_group_name = each.key
|
||||||
role = each.value.role
|
role = each.value.role
|
||||||
amount = each.value.instance_count
|
amount = each.value.initial_count
|
||||||
state_disk_size = each.value.disk_size
|
state_disk_size = each.value.disk_size
|
||||||
vcpus = each.value.vcpus
|
vcpus = each.value.vcpus
|
||||||
memory = each.value.memory
|
memory = each.value.memory
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
variable "node_groups" {
|
variable "node_groups" {
|
||||||
type = map(object({
|
type = map(object({
|
||||||
role = string
|
role = string
|
||||||
instance_count = number // number of instances in the node group
|
initial_count = number // number of instances in the node group
|
||||||
disk_size = number // size of state disk (GiB)
|
disk_size = number // size of state disk (GiB)
|
||||||
vcpus = number
|
vcpus = number
|
||||||
memory = number // amount of memory per instance (MiB)
|
memory = number // amount of memory per instance (MiB)
|
||||||
|
|
|
@ -199,8 +199,8 @@ func (v *AzureClusterVariables) String() string {
|
||||||
type AzureNodeGroup struct {
|
type AzureNodeGroup struct {
|
||||||
// Role is the role of the node group.
|
// Role is the role of the node group.
|
||||||
Role string `hcl:"role" cty:"role"`
|
Role string `hcl:"role" cty:"role"`
|
||||||
// InstanceCount is optional for upgrades.
|
// InitialCount is optional for upgrades.
|
||||||
InstanceCount *int `hcl:"instance_count" cty:"instance_count"`
|
InitialCount *int `hcl:"initial_count" cty:"initial_count"`
|
||||||
InstanceType string `hcl:"instance_type" cty:"instance_type"`
|
InstanceType string `hcl:"instance_type" cty:"instance_type"`
|
||||||
DiskSizeGB int `hcl:"disk_size" cty:"disk_size"`
|
DiskSizeGB int `hcl:"disk_size" cty:"disk_size"`
|
||||||
DiskType string `hcl:"disk_type" cty:"disk_type"`
|
DiskType string `hcl:"disk_type" cty:"disk_type"`
|
||||||
|
@ -335,8 +335,8 @@ func (v *QEMUVariables) String() string {
|
||||||
type QEMUNodeGroup struct {
|
type QEMUNodeGroup struct {
|
||||||
// Role is the role of the node group.
|
// Role is the role of the node group.
|
||||||
Role string `hcl:"role" cty:"role"`
|
Role string `hcl:"role" cty:"role"`
|
||||||
// InstanceCount is the number of instances to create.
|
// InitialCount is the number of instances to create.
|
||||||
InstanceCount int `hcl:"instance_count" cty:"instance_count"`
|
InitialCount int `hcl:"initial_count" cty:"initial_count"`
|
||||||
// DiskSize is the size of the disk to allocate to each node, in GiB.
|
// DiskSize is the size of the disk to allocate to each node, in GiB.
|
||||||
DiskSize int `hcl:"disk_size" cty:"disk_size"`
|
DiskSize int `hcl:"disk_size" cty:"disk_size"`
|
||||||
// CPUCount is the number of CPUs to allocate to each node.
|
// CPUCount is the number of CPUs to allocate to each node.
|
||||||
|
|
|
@ -172,7 +172,7 @@ func TestAzureClusterVariables(t *testing.T) {
|
||||||
NodeGroups: map[string]AzureNodeGroup{
|
NodeGroups: map[string]AzureNodeGroup{
|
||||||
"control_plane_default": {
|
"control_plane_default": {
|
||||||
Role: "ControlPlane",
|
Role: "ControlPlane",
|
||||||
InstanceCount: to.Ptr(1),
|
InitialCount: to.Ptr(1),
|
||||||
InstanceType: "Standard_D2s_v3",
|
InstanceType: "Standard_D2s_v3",
|
||||||
DiskType: "StandardSSD_LRS",
|
DiskType: "StandardSSD_LRS",
|
||||||
DiskSizeGB: 100,
|
DiskSizeGB: 100,
|
||||||
|
@ -200,7 +200,7 @@ node_groups = {
|
||||||
control_plane_default = {
|
control_plane_default = {
|
||||||
disk_size = 100
|
disk_size = 100
|
||||||
disk_type = "StandardSSD_LRS"
|
disk_type = "StandardSSD_LRS"
|
||||||
instance_count = 1
|
initial_count = 1
|
||||||
instance_type = "Standard_D2s_v3"
|
instance_type = "Standard_D2s_v3"
|
||||||
role = "ControlPlane"
|
role = "ControlPlane"
|
||||||
zones = null
|
zones = null
|
||||||
|
@ -275,7 +275,7 @@ func TestQEMUClusterVariables(t *testing.T) {
|
||||||
NodeGroups: map[string]QEMUNodeGroup{
|
NodeGroups: map[string]QEMUNodeGroup{
|
||||||
"control-plane": {
|
"control-plane": {
|
||||||
Role: role.ControlPlane.TFString(),
|
Role: role.ControlPlane.TFString(),
|
||||||
InstanceCount: 1,
|
InitialCount: 1,
|
||||||
DiskSize: 30,
|
DiskSize: 30,
|
||||||
CPUCount: 4,
|
CPUCount: 4,
|
||||||
MemorySize: 8192,
|
MemorySize: 8192,
|
||||||
|
@ -299,7 +299,7 @@ func TestQEMUClusterVariables(t *testing.T) {
|
||||||
node_groups = {
|
node_groups = {
|
||||||
control-plane = {
|
control-plane = {
|
||||||
disk_size = 30
|
disk_size = 30
|
||||||
instance_count = 1
|
initial_count = 1
|
||||||
memory = 8192
|
memory = 8192
|
||||||
role = "control-plane"
|
role = "control-plane"
|
||||||
vcpus = 4
|
vcpus = 4
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue