mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-05-02 14:26:23 -04:00
parent
a6d201b761
commit
130c61ffcf
10 changed files with 612 additions and 0 deletions
58
terraform/aws/modules/instance_group/main.tf
Normal file
58
terraform/aws/modules/instance_group/main.tf
Normal file
|
@ -0,0 +1,58 @@
|
|||
terraform {
|
||||
required_providers {
|
||||
aws = {
|
||||
source = "hashicorp/aws"
|
||||
version = "~> 4.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
locals {
|
||||
name = "${var.name}-${lower(var.role)}"
|
||||
}
|
||||
|
||||
|
||||
resource "aws_launch_configuration" "control_plane_launch_config" {
|
||||
name_prefix = local.name
|
||||
image_id = var.image_id
|
||||
instance_type = var.instance_type
|
||||
iam_instance_profile = var.iam_instance_profile
|
||||
metadata_options {
|
||||
http_tokens = "required"
|
||||
}
|
||||
|
||||
|
||||
lifecycle {
|
||||
create_before_destroy = true
|
||||
}
|
||||
}
|
||||
|
||||
resource "aws_autoscaling_group" "control_plane_autoscaling_group" {
|
||||
name = local.name
|
||||
launch_configuration = aws_launch_configuration.control_plane_launch_config.name
|
||||
min_size = 1
|
||||
max_size = 10
|
||||
desired_capacity = var.instance_count
|
||||
vpc_zone_identifier = [var.subnetwork]
|
||||
target_group_arns = var.target_group_arns
|
||||
|
||||
lifecycle {
|
||||
create_before_destroy = true
|
||||
}
|
||||
|
||||
tag {
|
||||
key = "Name"
|
||||
value = local.name
|
||||
propagate_at_launch = true
|
||||
}
|
||||
tag {
|
||||
key = "constellation-role"
|
||||
value = var.role
|
||||
propagate_at_launch = true
|
||||
}
|
||||
tag {
|
||||
key = "constellation-uid"
|
||||
value = var.uid
|
||||
propagate_at_launch = true
|
||||
}
|
||||
}
|
49
terraform/aws/modules/instance_group/variables.tf
Normal file
49
terraform/aws/modules/instance_group/variables.tf
Normal file
|
@ -0,0 +1,49 @@
|
|||
variable "name" {
|
||||
type = string
|
||||
description = "Base name of the instance group."
|
||||
}
|
||||
|
||||
variable "role" {
|
||||
type = string
|
||||
description = "The role of the instance group. Has to be 'ControlPlane' or 'Worker'."
|
||||
}
|
||||
|
||||
variable "uid" {
|
||||
type = string
|
||||
description = "UID of the cluster. This is used for tags."
|
||||
}
|
||||
|
||||
variable "instance_type" {
|
||||
type = string
|
||||
description = "Instance type for the nodes."
|
||||
}
|
||||
|
||||
variable "instance_count" {
|
||||
type = number
|
||||
description = "Number of instances in the instance group."
|
||||
}
|
||||
|
||||
variable "image_id" {
|
||||
type = string
|
||||
description = "Image ID for the nodes."
|
||||
}
|
||||
|
||||
variable "disk_size" {
|
||||
type = number
|
||||
description = "Disk size for the nodes, in GB."
|
||||
}
|
||||
|
||||
variable "target_group_arns" {
|
||||
type = list(string)
|
||||
description = "ARN of the target group."
|
||||
}
|
||||
|
||||
variable "subnetwork" {
|
||||
type = string
|
||||
description = "Name of the subnetwork to use."
|
||||
}
|
||||
|
||||
variable "iam_instance_profile" {
|
||||
type = string
|
||||
description = "IAM instance profile for the nodes."
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue