Skip to content

Commit

Permalink
Linter
Browse files Browse the repository at this point in the history
  • Loading branch information
Dennisvandermeulen committed Nov 4, 2024
1 parent e9f8fa8 commit e6b0a59
Show file tree
Hide file tree
Showing 4 changed files with 116 additions and 0 deletions.
38 changes: 38 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
data "azurerm_client_config" "current" {}

resource "azurerm_resource_group" "this" {
name = var.resource_group.name
location = var.location
tags = merge(
try(var.tags),
tomap({
"Resource Type" = "Resource Group"
})
)
}

module "keyvault_with_cmk" {
source = "github.com/schubergphilis/terraform-azure-mcaf-key-vault.git"

Check warning on line 15 in main.tf

View workflow job for this annotation

GitHub Actions / fmt-lint-validate

Module source "github.com/schubergphilis/terraform-azure-mcaf-key-vault.git" is not pinned

key_vault = {
name = var.key_vault.name
tenant_id = data.azurerm_client_config.current.tenant_id
resource_group_name = azurerm_resource_group.this.name
location = var.location
enabled_for_disk_encryption = true
enabled_for_deployment = false
enabled_for_template_deployment = false
enable_rbac_authorization = true
purge_protection = true
soft_delete_retention_days = 30
sku = "standard"
ip_rules = length(var.key_vault.ip_rules) == 0 ? null : var.key_vault.ip_rules
subnet_ids = length(var.key_vault.subnet_ids) == 0 ? null : var.key_vault.subnet_ids
network_bypass = "AzureServices"
cmk_keys_create = true
cmkrsa_key_name = var.key_vault.cmkrsa_key_name
cmkec_key_name = var.key_vault.cmkec_key_name
}

tags = var.tags
}
21 changes: 21 additions & 0 deletions outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
output "key_vault_id" {
value = module.keyvault_with_cmk.key_vault_id
}

output "key_vault_name" {
value = module.keyvault_with_cmk.key_vault_name
}

output "key_vault_uri" {
value = module.keyvault_with_cmk.key_vault_uri
}

output "key_vault_cmkrsa_key_name" {
value = module.keyvault_with_cmk.key_vault_cmkrsa_keyname
description = "CMK RSA Key Name"
}

output "key_vault_cmkrsa_id" {
value = module.keyvault_with_cmk.key_vault_cmkrsa_id
description = "CMK RSA Key ID"
}
10 changes: 10 additions & 0 deletions terraform.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
terraform {
required_version = ">= 1.7"

required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = ">= 4"
}
}
}
47 changes: 47 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
variable "resource_group" {
description = "The name of the resource group in which to create the resources."
type = object({
name = string
})
default = {
name = null
}
}

variable "key_vault" {
type = object({
name = string
enabled_for_disk_encryption = optional(bool, false)
enabled_for_deployment = optional(bool, false)
enabled_for_template_deployment = optional(bool, false)
enable_rbac_authorization = optional(bool, true)
purge_protection = optional(bool, true)
soft_delete_retention_days = optional(number, 30)
sku = optional(string, "standard")
ip_rules = optional(list(string), [])
subnet_ids = optional(list(string), [])
network_bypass = optional(string, "None")
cmk_keys_create = optional(bool, true)
cmkrsa_key_name = optional(string, "cmkrsa")
cmkec_key_name = optional(string, "cmkec")
cmk_rotation_period = optional(string, "P90D")
})
}

variable "location" {
description = "Location of the resources to create"
type = string
}

variable "tags" {
description = "A map of tags to assign to the resource."
type = map(string)
default = {}
}

variable "zones" {

Check warning on line 42 in variables.tf

View workflow job for this annotation

GitHub Actions / fmt-lint-validate

variable "zones" is declared but not used
type = list(string)
default = []
description = "A list of availability zones in which the resource should be created."
}

0 comments on commit e6b0a59

Please sign in to comment.