-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The overhaul focuses on simplifying the module dependencies and responsibilities. - Vault and backup modules no longer depend on an identity - Added a new module rules dedicated for role assignments to anything required by the VMSS such as the key vault and backup storage account - Moved custom roles to the new roles module - Removed the storage account custom role in favor of directly providing the storage container in the user data script - Removed useless empty BLOB creation in the storage account - Optimized configurations role assignments for least privilege - Updated some comments/descriptions
- Loading branch information
1 parent
185d1f4
commit c48973b
Showing
15 changed files
with
160 additions
and
130 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 |
---|---|---|
@@ -1,9 +1,19 @@ | ||
output "storage_account_id" { | ||
description = "Storage account identifier for storing GraphDB backups" | ||
value = azurerm_storage_account.graphdb-backup.id | ||
} | ||
|
||
output "storage_account_name" { | ||
description = "Storage account name for storing GraphDB backups" | ||
value = azurerm_storage_account.graphdb-backup.name | ||
} | ||
|
||
output "container_name" { | ||
output "storage_container_id" { | ||
description = "Identifier of the storage container for GraphDB backups" | ||
value = azurerm_storage_container.graphdb-backup.id | ||
} | ||
|
||
output "storage_container_name" { | ||
description = "Name of the storage container for GraphDB backups" | ||
value = azurerm_storage_container.graphdb-backup.name | ||
} |
This file contains 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 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 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 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 @@ | ||
# GraphDB Roles Module |
This file contains 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,45 @@ | ||
# Assign the identity to have read access to the key vault | ||
resource "azurerm_role_assignment" "graphdb-vmss-key-vault-reader" { | ||
principal_id = var.identity_principal_id | ||
scope = var.key_vault_id | ||
role_definition_name = "Key Vault Reader" | ||
} | ||
|
||
# Assign the identity to be able to upload GraphDB backups in the storage BLOB | ||
resource "azurerm_role_assignment" "graphdb-backup" { | ||
principal_id = var.identity_principal_id | ||
scope = var.backups_storage_container_id | ||
role_definition_name = "Storage Blob Data Contributor" | ||
} | ||
|
||
resource "azurerm_role_definition" "managed_disk_manager" { | ||
name = "${var.resource_name_prefix}-ManagedDiskManager-6" | ||
scope = var.resource_group_id | ||
description = "This is a custom role created via Terraform required for creating data disks for GraphDB" | ||
|
||
permissions { | ||
actions = [ | ||
"Microsoft.Compute/disks/read", | ||
"Microsoft.Compute/disks/write", | ||
"Microsoft.Compute/virtualMachineScaleSets/read", | ||
"Microsoft.Compute/virtualMachineScaleSets/virtualMachines/write", | ||
"Microsoft.Compute/virtualMachineScaleSets/virtualMachines/read", | ||
"Microsoft.Network/virtualNetworks/subnets/join/action", | ||
"Microsoft.Network/applicationGateways/backendAddressPools/join/action", | ||
"Microsoft.Network/networkSecurityGroups/join/action" | ||
] | ||
not_actions = [] | ||
} | ||
|
||
assignable_scopes = [ | ||
var.resource_group_id | ||
] | ||
} | ||
|
||
resource "azurerm_role_assignment" "rg-contributor-role" { | ||
principal_id = var.identity_principal_id | ||
scope = var.resource_group_id | ||
role_definition_name = azurerm_role_definition.managed_disk_manager.name | ||
|
||
depends_on = [azurerm_role_definition.managed_disk_manager] | ||
} |
Empty file.
This file contains 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,32 @@ | ||
# Common configurations | ||
|
||
variable "resource_name_prefix" { | ||
description = "Resource name prefix used for tagging and naming Azure resources" | ||
type = string | ||
} | ||
|
||
variable "resource_group_id" { | ||
description = "Identifier of the resource group where GraphDB will be deployed." | ||
type = string | ||
} | ||
|
||
# Identity | ||
|
||
variable "identity_principal_id" { | ||
description = "Principal identifier of a user assigned identity for assigning permissions" | ||
type = string | ||
} | ||
|
||
# Key Vault | ||
|
||
variable "key_vault_id" { | ||
description = "Identifier of a Key Vault for storing GraphDB configurations" | ||
type = string | ||
} | ||
|
||
# Backups storage | ||
|
||
variable "backups_storage_container_id" { | ||
description = "Identifier of the storage container for GraphDB backups" | ||
type = string | ||
} |
This file contains 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 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 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
Oops, something went wrong.