mirror of
https://github.com/edgelesssys/constellation.git
synced 2024-12-31 18:36:13 -05:00
9667dfff58
* all vars have snail_case * make iam schema consistent * infrastructure schema * terraform: update AWS infrastructure module * fix ci * terraform: update AWS infrastructure module * terraform: update AWS IAM module * terraform: update Azure Infrastructure module inputs Signed-off-by: Moritz Sanft <58110325+msanft@users.noreply.github.com> * terraform: update Azure IAM module Signed-off-by: Moritz Sanft <58110325+msanft@users.noreply.github.com> * terraform: update GCP infrastructure module Signed-off-by: Moritz Sanft <58110325+msanft@users.noreply.github.com> * terraform: update GCP IAM module Signed-off-by: Moritz Sanft <58110325+msanft@users.noreply.github.com> * terraform: update OpenStack Infrastructure module Signed-off-by: Moritz Sanft <58110325+msanft@users.noreply.github.com> * terraform: update QEMU Infrastructure module Signed-off-by: Moritz Sanft <58110325+msanft@users.noreply.github.com> * terraform-module: fix input name Signed-off-by: Moritz Sanft <58110325+msanft@users.noreply.github.com> * terraform: tidy * cli: ignore whitespace in Terraform variable tests * terraform-module: fix AWS output names * terraform-module: fix output references Signed-off-by: Moritz Sanft <58110325+msanft@users.noreply.github.com> * terraform: rename `api_server_cert_sans` * Update terraform/infrastructure/aws/modules/public_private_subnet/variables.tf Co-authored-by: Daniel Weiße <66256922+daniel-weisse@users.noreply.github.com> * fix self-managed * terraform: revert AWS modules output file renaming * terraform: remove duplicate varable declaration * terraform: rename Azure location field * ci: adjust output name in self-managed e2e test * e2e: continuously print output in upgrade test * e2e: write to output variables * cli: migrate IAM variable names * cli: make `location` field optional --------- Signed-off-by: Moritz Sanft <58110325+msanft@users.noreply.github.com> Co-authored-by: Moritz Sanft <58110325+msanft@users.noreply.github.com> Co-authored-by: Daniel Weiße <66256922+daniel-weisse@users.noreply.github.com>
125 lines
3.7 KiB
HCL
125 lines
3.7 KiB
HCL
terraform {
|
|
required_providers {
|
|
azurerm = {
|
|
source = "hashicorp/azurerm"
|
|
version = "3.74.0"
|
|
}
|
|
random = {
|
|
source = "hashicorp/random"
|
|
version = "3.6.0"
|
|
}
|
|
}
|
|
}
|
|
|
|
locals {
|
|
tags = merge(
|
|
var.tags,
|
|
{ constellation-role = var.role },
|
|
{ constellation-node-group = var.node_group_name },
|
|
)
|
|
group_uid = random_id.uid.hex
|
|
name = "${var.base_name}-${var.role}-${local.group_uid}"
|
|
}
|
|
|
|
resource "random_id" "uid" {
|
|
byte_length = 4
|
|
}
|
|
|
|
resource "random_password" "password" {
|
|
length = 16
|
|
min_lower = 1
|
|
min_upper = 1
|
|
min_numeric = 1
|
|
min_special = 1
|
|
}
|
|
|
|
resource "azurerm_linux_virtual_machine_scale_set" "scale_set" {
|
|
name = local.name
|
|
resource_group_name = var.resource_group
|
|
location = var.location
|
|
sku = var.instance_type
|
|
instances = var.initial_count
|
|
admin_username = "adminuser"
|
|
admin_password = random_password.password.result
|
|
overprovision = false
|
|
provision_vm_agent = false
|
|
vtpm_enabled = true
|
|
disable_password_authentication = false
|
|
upgrade_mode = "Manual"
|
|
secure_boot_enabled = var.secure_boot
|
|
# specify the image id only if a non-marketplace image is used
|
|
source_image_id = var.marketplace_image != null ? null : var.image_id
|
|
tags = local.tags
|
|
zones = var.zones
|
|
identity {
|
|
type = "UserAssigned"
|
|
identity_ids = [var.user_assigned_identity]
|
|
}
|
|
|
|
boot_diagnostics {}
|
|
|
|
dynamic "os_disk" {
|
|
for_each = var.confidential_vm ? [1] : [] # if confidential_vm is true
|
|
content {
|
|
security_encryption_type = "VMGuestStateOnly"
|
|
caching = "ReadWrite"
|
|
storage_account_type = "Premium_LRS"
|
|
}
|
|
}
|
|
dynamic "os_disk" {
|
|
for_each = var.confidential_vm ? [] : [1] # else
|
|
content {
|
|
caching = "ReadWrite"
|
|
storage_account_type = "Premium_LRS"
|
|
}
|
|
}
|
|
|
|
# Specify marketplace plan and image if set
|
|
dynamic "plan" {
|
|
for_each = var.marketplace_image != null ? [1] : [] # if a marketplace image is set
|
|
content {
|
|
name = var.marketplace_image.name
|
|
publisher = var.marketplace_image.publisher
|
|
product = var.marketplace_image.product
|
|
}
|
|
}
|
|
dynamic "source_image_reference" {
|
|
for_each = var.marketplace_image != null ? [1] : [] # if a marketplace image is set
|
|
content {
|
|
publisher = var.marketplace_image.publisher
|
|
offer = var.marketplace_image.product
|
|
sku = var.marketplace_image.name
|
|
version = var.marketplace_image.version
|
|
}
|
|
}
|
|
|
|
data_disk {
|
|
storage_account_type = var.state_disk_type
|
|
disk_size_gb = var.state_disk_size
|
|
caching = "ReadWrite"
|
|
lun = 0
|
|
}
|
|
|
|
network_interface {
|
|
name = "node-network"
|
|
primary = true
|
|
network_security_group_id = var.network_security_group_id
|
|
|
|
ip_configuration {
|
|
name = "node-network"
|
|
primary = true
|
|
subnet_id = var.subnet_id
|
|
load_balancer_backend_address_pool_ids = var.backend_address_pool_ids
|
|
}
|
|
}
|
|
|
|
lifecycle {
|
|
ignore_changes = [
|
|
name, # required. Allow legacy scale sets to keep their old names
|
|
instances, # required. autoscaling modifies the instance count externally
|
|
source_image_id, # required. update procedure modifies the image id externally
|
|
source_image_reference, # required. update procedure modifies the image reference externally
|
|
]
|
|
}
|
|
}
|