-
Notifications
You must be signed in to change notification settings - Fork 0
Feature/aks #52
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
Merged
+1,959
−16
Merged
Feature/aks #52
Changes from 12 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
36af546
feat: adding aks building block
florianow 2796ae7
feat: adding README.me
florianow 38b063c
feat: adding backplane
florianow 57ef494
feat: adding logo
florianow 77cb299
feat: typo in README
florianow fcfd2c4
feat: adding optional LAW
florianow 4f33034
Merge remote-tracking branch 'origin/main' into feature/aks
florianow fb89f45
chore: update module
florianow 3852fed
chore: ignore *terraform* folders or files
florianow 7bea02b
test: adding test file
florianow 8470f91
feat: adding private Clusters
florianow c15f627
Merge branch 'main' into feature/aks
florianow 69f24e1
feat: adding logo
florianow 491e71a
feat: updating backplane for Hub connection
florianow 1920e18
feat: updating Readme files
florianow 2945e61
feat: adding run first test successfully
florianow ca1a4ea
chore: cleanup
florianow 4dd6cd6
Apply suggestion from @Copilot
florianow File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,6 +18,5 @@ yarn-error.log* | |
| *.terraform* | ||
| *.tfstate* | ||
| *tfvars* | ||
|
|
||
| .terraform.lock.hcl | ||
| .env | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| # AKS CLuster | ||
|
|
||
| This documentation is intended as a reference documentation for cloud foundation or platform engineers using this module. | ||
|
|
||
| ## Permissions | ||
|
|
||
| This is a very simple building block, which means we let the SPN have access to AKS Clusters | ||
| across all subscriptions underneath a management group (typically the top-level management group for landing zones). | ||
|
|
||
| <!-- BEGIN_TF_DOCS --> | ||
| ## Requirements | ||
|
|
||
| | Name | Version | | ||
| |------|---------| | ||
| | <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.3.0 | | ||
| | <a name="requirement_azurerm"></a> [azurerm](#requirement\_azurerm) | ~> 4.36.0 | | ||
|
|
||
| ## Modules | ||
|
|
||
| No modules. | ||
|
|
||
| ## Resources | ||
|
|
||
| | Name | Type | | ||
| |------|------| | ||
| | [azurerm_role_assignment.buildingblock_deploy](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/role_assignment) | resource | | ||
| | [azurerm_role_assignment.buildingblock_deploy_hub](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/role_assignment) | resource | | ||
| | [azurerm_role_definition.buildingblock_deploy](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/role_definition) | resource | | ||
| | [azurerm_role_definition.buildingblock_deploy_hub](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/role_definition) | resource | | ||
|
|
||
| ## Inputs | ||
|
|
||
| | Name | Description | Type | Default | Required | | ||
| |------|-------------|------|---------|:--------:| | ||
| | <a name="input_name"></a> [name](#input\_name) | name of the building block, used for naming resources | `string` | `"aks"` | no | | ||
| | <a name="input_principal_ids"></a> [principal\_ids](#input\_principal\_ids) | set of principal ids that will be granted permissions to deploy the building block | `set(string)` | n/a | yes | | ||
| | <a name="input_scope"></a> [scope](#input\_scope) | Scope where the building block should be deployable, typically the parent of all Landing Zones. | `string` | n/a | yes | | ||
|
|
||
| ## Outputs | ||
|
|
||
| | Name | Description | | ||
| |------|-------------| | ||
| | <a name="output_documentation_md"></a> [documentation\_md](#output\_documentation\_md) | Markdown documentation with information about the AKS Building Block building block backplane | | ||
| | <a name="output_hub_role_assignment_ids"></a> [hub\_role\_assignment\_ids](#output\_hub\_role\_assignment\_ids) | The IDs of the hub role assignments for the service principals. | | ||
| | <a name="output_hub_role_assignment_principal_ids"></a> [hub\_role\_assignment\_principal\_ids](#output\_hub\_role\_assignment\_principal\_ids) | The principal IDs of the service principals that have been assigned the hub role. | | ||
| | <a name="output_hub_role_definition_id"></a> [hub\_role\_definition\_id](#output\_hub\_role\_definition\_id) | The ID of the role definition that enables deployment of the building block to the hub. | | ||
| | <a name="output_hub_role_definition_name"></a> [hub\_role\_definition\_name](#output\_hub\_role\_definition\_name) | The name of the role definition that enables deployment of the building block to the hub. | | ||
| | <a name="output_role_assignment_ids"></a> [role\_assignment\_ids](#output\_role\_assignment\_ids) | The IDs of the role assignments for the service principals. | | ||
| | <a name="output_role_assignment_principal_ids"></a> [role\_assignment\_principal\_ids](#output\_role\_assignment\_principal\_ids) | The principal IDs of the service principals that have been assigned the role. | | ||
| | <a name="output_role_definition_id"></a> [role\_definition\_id](#output\_role\_definition\_id) | The ID of the role definition that enables deployment of the building block to subscriptions. | | ||
| | <a name="output_role_definition_name"></a> [role\_definition\_name](#output\_role\_definition\_name) | The name of the role definition that enables deployment of the building block to subscriptions. | | ||
| | <a name="output_scope"></a> [scope](#output\_scope) | The scope where the role definition and role assignments are applied. | | ||
| <!-- END_TF_DOCS --> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| output "documentation_md" { | ||
| value = <<EOF | ||
| # AKS Building Block | ||
|
|
||
| The Azure AKS Building Block configures a AKS (Kubernetes Service) cluster in the Azure cloud, which can be used to deploy and run containerized applications. | ||
|
|
||
| ## Automation | ||
|
|
||
| We automate the deployment of a AKS Building Block using the common [Azure Building Blocks Automation Infrastructure](../automation.md). | ||
| In order to deploy this building block, this infrastructure receives the following roles. | ||
|
|
||
| | Role Name | Description | Permissions | | ||
| |-----------|-------------|-------------| | ||
| | `${azurerm_role_definition.buildingblock_deploy.name}` | ${azurerm_role_definition.buildingblock_deploy.description} | ${join("<br>", formatlist("- `%s`", azurerm_role_definition.buildingblock_deploy.permissions[0].actions))} | | ||
|
|
||
| EOF | ||
| description = "Markdown documentation with information about the AKS Building Block building block backplane" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| resource "azurerm_role_definition" "buildingblock_deploy" { | ||
| name = "${var.name}-deploy" | ||
| scope = var.scope | ||
| description = "Enables deployment of the ${var.name} building block to subscriptions" | ||
|
|
||
| permissions { | ||
| actions = [ | ||
| "Microsoft.ContainerService/managedClusters/read", | ||
| "Microsoft.ContainerService/managedClusters/write", | ||
| "Microsoft.ContainerService/managedClusters/delete", | ||
| "Microsoft.ContainerService/managedClusters/listClusterAdminCredential/action", | ||
| "Microsoft.ContainerService/managedClusters/listClusterUserCredential/action", | ||
| "Microsoft.ContainerService/managedClusters/listClusterMonitoringUserCredential/action", | ||
| "Microsoft.ContainerService/managedClusters/accessProfiles/listCredential/action", | ||
| "Microsoft.ContainerService/managedClusters/accessProfiles/read", | ||
| "Microsoft.ContainerService/managedClusters/agentPools/read", | ||
| "Microsoft.ContainerService/managedClusters/agentPools/write", | ||
| "Microsoft.ContainerService/managedClusters/agentPools/delete", | ||
| "Microsoft.Network/virtualNetworks/read", | ||
| "Microsoft.Network/virtualNetworks/write", | ||
| "Microsoft.Network/virtualNetworks/delete", | ||
| "Microsoft.Network/virtualNetworks/subnets/read", | ||
| "Microsoft.Network/virtualNetworks/subnets/write", | ||
| "Microsoft.Network/virtualNetworks/subnets/delete", | ||
| "Microsoft.Network/virtualNetworks/subnets/join/action", | ||
| "Microsoft.Network/virtualNetworks/virtualNetworkPeerings/read", | ||
| "Microsoft.Network/virtualNetworks/virtualNetworkPeerings/write", | ||
| "Microsoft.Network/virtualNetworks/virtualNetworkPeerings/delete", | ||
| "Microsoft.Network/virtualNetworks/peer/action", | ||
| "Microsoft.Network/networkInterfaces/read", | ||
| "Microsoft.Network/networkSecurityGroups/read", | ||
| "Microsoft.Network/networkSecurityGroups/write", | ||
| "Microsoft.Network/networkSecurityGroups/delete", | ||
| "Microsoft.Network/publicIPAddresses/read", | ||
| "Microsoft.Network/publicIPAddresses/write", | ||
| "Microsoft.Network/publicIPAddresses/delete", | ||
| "Microsoft.Network/loadBalancers/read", | ||
| "Microsoft.Network/loadBalancers/write", | ||
| "Microsoft.Network/loadBalancers/delete", | ||
| "Microsoft.Network/privateDnsZones/read", | ||
| "Microsoft.Network/privateDnsZones/write", | ||
| "Microsoft.Network/privateDnsZones/delete", | ||
| "Microsoft.Network/privateDnsZones/virtualNetworkLinks/read", | ||
| "Microsoft.Network/privateDnsZones/virtualNetworkLinks/write", | ||
| "Microsoft.Network/privateDnsZones/virtualNetworkLinks/delete", | ||
| "Microsoft.Resources/deployments/read", | ||
| "Microsoft.Resources/deployments/write", | ||
| "Microsoft.Resources/deployments/delete", | ||
| "Microsoft.Resources/subscriptions/resourceGroups/read", | ||
| "Microsoft.Resources/subscriptions/resourceGroups/write", | ||
| "Microsoft.Resources/subscriptions/resourceGroups/delete", | ||
| "Microsoft.OperationalInsights/workspaces/read", | ||
| "Microsoft.OperationalInsights/workspaces/write", | ||
| "Microsoft.OperationalInsights/workspaces/delete", | ||
| "Microsoft.Insights/diagnosticSettings/read", | ||
| "Microsoft.Insights/diagnosticSettings/write", | ||
| "Microsoft.Insights/diagnosticSettings/delete", | ||
| "Microsoft.Authorization/roleAssignments/read" | ||
| ] | ||
| } | ||
| } | ||
|
|
||
| resource "azurerm_role_assignment" "buildingblock_deploy" { | ||
| for_each = var.principal_ids | ||
|
|
||
| role_definition_id = azurerm_role_definition.buildingblock_deploy.role_definition_resource_id | ||
| principal_id = each.value | ||
| scope = var.scope | ||
| } | ||
|
|
||
| resource "azurerm_role_definition" "buildingblock_deploy_hub" { | ||
| name = "${var.name}-deploy-hub" | ||
| description = "Enables deployment of the ${var.name} building block to the hub (for private cluster peering)" | ||
| scope = var.scope | ||
|
|
||
| permissions { | ||
| actions = [ | ||
| "Microsoft.Resources/subscriptions/resourceGroups/read", | ||
| "Microsoft.Network/virtualNetworks/read", | ||
| "Microsoft.Network/virtualNetworks/virtualNetworkPeerings/read", | ||
| "Microsoft.Network/virtualNetworks/virtualNetworkPeerings/write", | ||
| "Microsoft.Network/virtualNetworks/virtualNetworkPeerings/delete", | ||
| "Microsoft.Network/virtualNetworks/peer/action", | ||
| ] | ||
| } | ||
| } | ||
|
|
||
| resource "azurerm_role_assignment" "buildingblock_deploy_hub" { | ||
| for_each = var.principal_ids | ||
|
|
||
| role_definition_id = azurerm_role_definition.buildingblock_deploy_hub.role_definition_resource_id | ||
| description = azurerm_role_definition.buildingblock_deploy_hub.description | ||
| principal_id = each.value | ||
| scope = var.scope | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| output "role_definition_id" { | ||
| value = azurerm_role_definition.buildingblock_deploy.id | ||
| description = "The ID of the role definition that enables deployment of the building block to subscriptions." | ||
| } | ||
|
|
||
| output "role_definition_name" { | ||
| value = azurerm_role_definition.buildingblock_deploy.name | ||
| description = "The name of the role definition that enables deployment of the building block to subscriptions." | ||
| } | ||
|
|
||
| output "role_assignment_ids" { | ||
| value = [for id in azurerm_role_assignment.buildingblock_deploy : id.id] | ||
| description = "The IDs of the role assignments for the service principals." | ||
| } | ||
|
|
||
| output "role_assignment_principal_ids" { | ||
| value = [for id in azurerm_role_assignment.buildingblock_deploy : id.principal_id] | ||
| description = "The principal IDs of the service principals that have been assigned the role." | ||
| } | ||
|
|
||
| output "scope" { | ||
| value = var.scope | ||
| description = "The scope where the role definition and role assignments are applied." | ||
| } | ||
|
|
||
| output "hub_role_definition_id" { | ||
| value = azurerm_role_definition.buildingblock_deploy_hub.id | ||
| description = "The ID of the role definition that enables deployment of the building block to the hub." | ||
| } | ||
|
|
||
| output "hub_role_definition_name" { | ||
| value = azurerm_role_definition.buildingblock_deploy_hub.name | ||
| description = "The name of the role definition that enables deployment of the building block to the hub." | ||
| } | ||
|
|
||
| output "hub_role_assignment_ids" { | ||
| value = { for id in var.principal_ids : id => azurerm_role_assignment.buildingblock_deploy_hub[id].id } | ||
| description = "The IDs of the hub role assignments for the service principals." | ||
| } | ||
|
|
||
| output "hub_role_assignment_principal_ids" { | ||
| value = { for id in var.principal_ids : id => azurerm_role_assignment.buildingblock_deploy_hub[id].principal_id } | ||
| description = "The principal IDs of the service principals that have been assigned the hub role." | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| provider "azurerm" { | ||
| features {} | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| variable "name" { | ||
| type = string | ||
| nullable = false | ||
| default = "aks" | ||
| description = "name of the building block, used for naming resources" | ||
| validation { | ||
| condition = can(regex("^[-a-z0-9]+$", var.name)) | ||
| error_message = "Only alphanumeric lowercase characters and dashes are allowed" | ||
| } | ||
| } | ||
|
|
||
| variable "principal_ids" { | ||
| type = string | ||
| description = "Object ID of the SCP (Terraform SPN or federated identity)" | ||
| } | ||
|
|
||
| variable "scope" { | ||
| type = string | ||
| nullable = false | ||
| description = "Scope where the building block should be deployable, typically the parent of all Landing Zones." | ||
| } | ||
|
|
||
| variable "principal_ids" { | ||
| type = set(string) | ||
| nullable = false | ||
| description = "set of principal ids that will be granted permissions to deploy the building block" | ||
| } | ||
florianow marked this conversation as resolved.
Show resolved
Hide resolved
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| terraform { | ||
| required_version = ">= 1.3.0" | ||
|
|
||
| required_providers { | ||
| azurerm = { | ||
| source = "hashicorp/azurerm" | ||
| version = "~> 4.36.0" | ||
| } | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.