mirror of
https://github.com/edgelesssys/constellation.git
synced 2024-12-19 04:44:42 -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>
71 lines
2.1 KiB
HCL
71 lines
2.1 KiB
HCL
terraform {
|
|
required_providers {
|
|
azurerm = {
|
|
source = "hashicorp/azurerm"
|
|
version = "3.74.0"
|
|
}
|
|
azuread = {
|
|
source = "hashicorp/azuread"
|
|
version = "2.43.0"
|
|
}
|
|
}
|
|
}
|
|
|
|
# Configure Azure resource management provider
|
|
provider "azurerm" {
|
|
features {
|
|
resource_group {
|
|
prevent_deletion_if_contains_resources = false
|
|
}
|
|
}
|
|
}
|
|
|
|
# Configure Azure active directory provider
|
|
provider "azuread" {
|
|
tenant_id = data.azurerm_subscription.current.tenant_id
|
|
}
|
|
|
|
# Access current subscription (available via Azure CLI)
|
|
data "azurerm_subscription" "current" {}
|
|
|
|
# Access current AzureAD configuration
|
|
data "azuread_client_config" "current" {}
|
|
|
|
# Create base resource group
|
|
resource "azurerm_resource_group" "base_resource_group" {
|
|
name = var.resource_group_name
|
|
location = var.location
|
|
}
|
|
|
|
# Create identity resource group
|
|
resource "azurerm_resource_group" "identity_resource_group" {
|
|
name = "${var.resource_group_name}-identity"
|
|
location = var.location
|
|
}
|
|
|
|
# Create managed identity
|
|
resource "azurerm_user_assigned_identity" "identity_uami" {
|
|
location = var.location
|
|
name = var.service_principal_name
|
|
resource_group_name = azurerm_resource_group.identity_resource_group.name
|
|
}
|
|
|
|
# Assign roles to managed identity
|
|
resource "azurerm_role_assignment" "virtual_machine_contributor_role" {
|
|
scope = azurerm_resource_group.base_resource_group.id
|
|
role_definition_name = "Virtual Machine Contributor"
|
|
principal_id = azurerm_user_assigned_identity.identity_uami.principal_id
|
|
}
|
|
|
|
resource "azurerm_role_assignment" "application_insights_component_contributor_role" {
|
|
scope = azurerm_resource_group.base_resource_group.id
|
|
role_definition_name = "Application Insights Component Contributor"
|
|
principal_id = azurerm_user_assigned_identity.identity_uami.principal_id
|
|
}
|
|
|
|
resource "azurerm_role_assignment" "uami_owner_role" {
|
|
scope = azurerm_resource_group.base_resource_group.id
|
|
role_definition_name = "Owner"
|
|
principal_id = azurerm_user_assigned_identity.identity_uami.principal_id
|
|
}
|