Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add container app module #1792

Merged
merged 7 commits into from
Nov 24, 2023
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/standalone-compute.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
"compute/batch/batch_account/100-batch-account",
"compute/batch/batch_account/200-batch-account-private-endpoint",
"compute/batch/batch_application/100-batch-application",
"compute/container_app/101-simple-container-app-env",
"compute/container_app/102-simple-private-container-app-env",
"compute/container_app/103-private-container-app-env",
"compute/container_groups/100-aci-rover-github-runner",
"compute/container_groups/101-aci-nginx",
"compute/container_registry/100-simple-acr",
Expand Down
15 changes: 15 additions & 0 deletions container_app_dapr_components.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module "container_app_dapr_components" {
source = "./modules/compute/container_app_dapr_component"
for_each = local.compute.container_app_dapr_components

base_tags = local.global_settings.inherit_tags
container_app_environment_id = can(each.value.container_app_environment_id) ? each.value.container_app_environment_id : local.combined_objects_container_app_environments[try(each.value.lz_key, local.client_config.landingzone_key)][each.value.container_app_environment_key].id
client_config = local.client_config
global_settings = local.global_settings
settings = each.value
}

output "container_app_dapr_components" {
value = module.container_app_dapr_components
}

15 changes: 15 additions & 0 deletions container_app_environment_certificates.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module "container_app_environment_certificates" {
source = "./modules/compute/container_app_environment_certificate"
for_each = local.compute.container_app_environment_certificates

base_tags = local.global_settings.inherit_tags
container_app_environment_id = can(each.value.container_app_environment_id) ? each.value.container_app_environment_id : local.combined_objects_container_app_environments[try(each.value.lz_key, local.client_config.landingzone_key)][each.value.container_app_environment_key].id
client_config = local.client_config
global_settings = local.global_settings
settings = each.value
}

output "container_app_environment_certificates" {
value = module.container_app_environment_certificates
}

18 changes: 18 additions & 0 deletions container_app_environment_storages.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
module "container_app_environment_storages" {
source = "./modules/compute/container_app_environment_storage"
for_each = local.compute.container_app_environment_storages

base_tags = local.global_settings.inherit_tags
container_app_environment_id = can(each.value.container_app_environment_id) ? each.value.container_app_environment_id : local.combined_objects_container_app_environments[try(each.value.lz_key, local.client_config.landingzone_key)][each.value.container_app_environment_key].id
client_config = local.client_config
global_settings = local.global_settings
combined_resources = {
storage_accounts = local.combined_objects_storage_accounts
}
settings = each.value
}

output "container_app_environment_storages" {
value = module.container_app_environment_storages
}

21 changes: 21 additions & 0 deletions container_app_environments.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
module "container_app_environments" {
source = "./modules/compute/container_app_environment"
for_each = local.compute.container_app_environments

location = can(local.global_settings.regions[each.value.region]) ? local.global_settings.regions[each.value.region] : local.combined_objects_resource_groups[try(each.value.resource_group.lz_key, local.client_config.landingzone_key)][try(each.value.resource_group.key, each.value.resource_group_key)].location
resource_group = local.combined_objects_resource_groups[try(each.value.resource_group.lz_key, local.client_config.landingzone_key)][try(each.value.resource_group_key, each.value.resource_group.key)]
resource_group_name = can(each.value.resource_group.name) || can(each.value.resource_group_name) ? try(each.value.resource_group.name, each.value.resource_group_name) : local.combined_objects_resource_groups[try(each.value.resource_group.lz_key, local.client_config.landingzone_key)][try(each.value.resource_group_key, each.value.resource_group.key)].name
base_tags = local.global_settings.inherit_tags
subnet_id = can(each.value.subnet_id) ? each.value.subnet_id : try(local.combined_objects_networking[try(each.value.vnet.lz_key, local.client_config.landingzone_key)][each.value.vnet.vnet_key].subnets[each.value.vnet.subnet_key].id, null)
client_config = local.client_config
combined_diagnostics = local.combined_diagnostics
diagnostic_profiles = try(each.value.diagnostic_profiles, {})
diagnostics = local.combined_diagnostics
global_settings = local.global_settings
settings = each.value
}

output "container_app_environments" {
value = module.container_app_environments
}

27 changes: 27 additions & 0 deletions container_apps.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
module "container_apps" {
source = "./modules/compute/container_app"
for_each = local.compute.container_apps

location = can(local.global_settings.regions[each.value.region]) ? local.global_settings.regions[each.value.region] : local.combined_objects_resource_groups[try(each.value.resource_group.lz_key, local.client_config.landingzone_key)][try(each.value.resource_group.key, each.value.resource_group_key)].location
resource_group = local.combined_objects_resource_groups[try(each.value.resource_group.lz_key, local.client_config.landingzone_key)][try(each.value.resource_group_key, each.value.resource_group.key)]
resource_group_name = can(each.value.resource_group.name) || can(each.value.resource_group_name) ? try(each.value.resource_group.name, each.value.resource_group_name) : local.combined_objects_resource_groups[try(each.value.resource_group.lz_key, local.client_config.landingzone_key)][try(each.value.resource_group_key, each.value.resource_group.key)].name
base_tags = local.global_settings.inherit_tags
container_app_environment_id = can(each.value.container_app_environment_id) ? each.value.container_app_environment_id : local.combined_objects_container_app_environments[try(each.value.lz_key, local.client_config.landingzone_key)][each.value.container_app_environment_key].id
client_config = local.client_config
combined_diagnostics = local.combined_diagnostics
diagnostic_profiles = try(each.value.diagnostic_profiles, {})
diagnostics = local.combined_diagnostics
combined_resources = {
keyvaults = local.combined_objects_keyvaults
managed_identities = local.combined_objects_managed_identities
container_app_environment_certificates = local.combined_objects_container_app_environment_certificates
container_app_environment_storages = local.combined_objects_container_app_environment_storages
}
global_settings = local.global_settings
settings = each.value
}

output "container_apps" {
value = module.container_apps
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
global_settings = {
default_region = "region1"
regions = {
region1 = "canadacentral"
}
}

resource_groups = {
rg1 = {
name = "container-app-001"
region = "region1"
}
}

diagnostic_log_analytics = {
central_logs_region1 = {
region = "region1"
name = "logs"
resource_group_key = "rg1"
}
}

container_app_environments = {
cae1 = {
name = "cont-app-env-001"
region = "region1"
resource_group_key = "rg1"
log_analytics_key = "central_logs_region1"
}
}

container_apps = {
ca1 = {
name = "nginx-app"
container_app_environment_key = "cae1"
resource_group_key = "rg1"

revision_mode = "Single"
template = {
container = {
cont1 = {
name = "nginx"
image = "nginx:latest"
cpu = 0.5
memory = "1Gi"
}
}
min_replicas = 1
max_replicas = 1
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
global_settings = {
default_region = "region1"
regions = {
region1 = "canadacentral"
}
}

resource_groups = {
rg1 = {
name = "container-app-001"
region = "region1"
}
}

diagnostic_log_analytics = {
central_logs_region1 = {
region = "region1"
name = "logs"
resource_group_key = "rg1"
}
}

vnets = {
cae_re1 = {
resource_group_key = "rg1"
region = "region1"
vnet = {
name = "container-app-network"
address_space = ["100.64.0.0/20"]
}
specialsubnets = {}
subnets = {
cae1 = {
name = "container-app-snet"
cidr = ["100.64.0.0/21"]
nsg_key = "empty_nsg"
}
}

}
}

network_security_group_definition = {
# This entry is applied to all subnets with no NSG defined
empty_nsg = {}
}

container_app_environments = {
cae1 = {
name = "cont-app-env-001"
region = "region1"
resource_group_key = "rg1"
log_analytics_key = "central_logs_region1"
vnet = {
vnet_key = "cae_re1"
subnet_key = "cae1"
}
internal_load_balancer_enabled = true

tags = {
environment = "testing"
}
}
}

container_apps = {
ca1 = {
name = "nginx-app"
container_app_environment_key = "cae1"
resource_group_key = "rg1"

revision_mode = "Single"
template = {
container = {
cont1 = {
name = "nginx"
image = "nginx:latest"
cpu = 0.5
memory = "1Gi"
}
}
min_replicas = 1
max_replicas = 1
}
}
}
Loading