Skip to content

Commit 109c623

Browse files
committed
adding terraform v0.15 support
1 parent d8fce9e commit 109c623

File tree

7 files changed

+34
-25
lines changed

7 files changed

+34
-25
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
# .tfstate files
55
*.tfstate
66
*.tfstate.*
7+
*.terraform.lock.hcl
78

89
# Crash log files
910
crash.log

README.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ This Terraform Module creates a Key Vault also adds required access policies for
99
```hcl
1010
module "key-vault" {
1111
source = "kumarvna/key-vault/azurerm"
12-
version = "2.0.0"
12+
version = "2.1.0"
1313
1414
# Resource Group and Key Vault pricing tier details
1515
resource_group_name = "rg-demo-project-shared-westeurope-001"
@@ -73,7 +73,7 @@ Default action is set to `Allow` when no network rules matched. A `virtual_netwo
7373
```hcl
7474
module "key-vault" {
7575
source = "kumarvna/key-vault/azurerm"
76-
version = "2.0.0"
76+
version = "2.1.0"
7777
7878
# .... omitted
7979
@@ -155,7 +155,7 @@ End Date of the Project|Date when this application, workload, or service is plan
155155
```hcl
156156
module "key-vault" {
157157
source = "kumarvna/key-vault/azurerm"
158-
version = "2.0.0"
158+
version = "2.1.0"
159159
160160
# ... omitted
161161
@@ -174,15 +174,15 @@ module "key-vault" {
174174
Name | Version
175175
-----|--------
176176
terraform | >= 0.13
177-
azurerm | ~> 2.27
177+
azurerm | >= 2.59.0
178178

179179
## Providers
180180

181181
| Name | Version |
182182
|------|---------|
183-
azurerm | 2.27
184-
random | n/a
185-
azuread | n/a
183+
azurerm | >= 2.59.0
184+
random | >= 3.1.0
185+
azuread | >= 1.4.0
186186

187187
## Inputs
188188

@@ -195,7 +195,8 @@ Name | Description | Type | Default
195195
`enabled_for_disk_encryption`|Allow Disk Encryption to retrieve secrets from the vault and unwrap keys|string|`"false"`
196196
`enabled_for_template_deployment`|Allow Resource Manager to retrieve secrets from the Key Vault|string|`"false"`
197197
`enable_purge_protection`|Is Purge Protection enabled for this Key Vault?|string|`"false"`
198-
`enable_soft_delete`|Should Soft Delete be enabled for this Key Vault?|string|`"false"`
198+
`enable_rbac_authorization`|Specify whether Azure Key Vault uses Role Based Access Control (RBAC) for authorization of data actions|string|`false`
199+
`soft_delete_retention_days`|The number of days that items should be retained for once soft-deleted. The valid value can be between 7 and 90 days|string|`90`
199200
`access_policies`|List of access policies for the Key Vault|list|`{}`
200201
`azure_ad_user_principal_names`|List of user principal names of Azure AD users|list| `[]`
201202
`azure_ad_group_names`|List of names of Azure AD groups|list|`[]`

examples/complete/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Terraform Module to create a Key Vault also adds required access policies for AD
77
```hcl
88
module "key-vault" {
99
source = "kumarvna/key-vault/azurerm"
10-
version = "2.0.0"
10+
version = "2.1.0"
1111
1212
# Resource Group and Key Vault pricing tier details
1313
resource_group_name = "rg-demo-project-shared-westeurope-001"

examples/complete/main.tf

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
module "key-vault" {
22
source = "kumarvna/key-vault/azurerm"
3-
version = "2.0.0"
3+
version = "2.1.0"
44

55
# Resource Group and Key Vault pricing tier details
6-
resource_group_name = "rg-demo-project-shared-westeurope-001"
6+
resource_group_name = "rg-sap-test-kumars" #"rg-shared-westeurope-01"
77
key_vault_name = "demo-project-shard"
88
key_vault_sku_pricing_tier = "premium"
99

1010
# Once `Purge Protection` has been Enabled it's not possible to Disable it
1111
# Deleting the Key Vault with `Purge Protection` enabled will schedule the Key Vault to be deleted (currently 90 days)
1212
# Once `Soft Delete` has been Enabled it's not possible to Disable it.
1313
enable_purge_protection = false
14-
enable_soft_delete = false
1514

1615
# Adding Key valut logs to Azure monitoring and Log Analytics space
1716
log_analytics_workspace_id = var.log_analytics_workspace_id
@@ -21,18 +20,19 @@ module "key-vault" {
2120
# Make sure to use list of user principal names of Azure AD users.
2221
access_policies = [
2322
{
24-
azure_ad_user_principal_names = ["user1@example.com", "user2@example.com"]
23+
azure_ad_user_principal_names = ["harshal.yadwadkar@tietoevry.com", "sandeep.kannan@tietoevry.com"]
2524
key_permissions = ["get", "list"]
2625
secret_permissions = ["get", "list"]
2726
certificate_permissions = ["get", "import", "list"]
2827
storage_permissions = ["backup", "get", "list", "recover"]
2928
},
3029

31-
# Access policies for AD Groups, enable this feature to provide list of Azure AD groups and set permissions.
30+
/* # Access policies for AD Groups, enable this feature to provide list of Azure AD groups and set permissions.
3231
{
3332
azure_ad_group_names = ["ADGroupName1", "ADGroupName2"]
3433
secret_permissions = ["get", "list", "set"]
3534
},
35+
*/
3636
]
3737

3838
# Create a required Secrets as per your need.

main.tf

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ locals {
7979
}
8080

8181
data "azuread_group" "adgrp" {
82-
count = length(local.azure_ad_group_names)
83-
name = local.azure_ad_group_names[count.index]
82+
count = length(local.azure_ad_group_names)
83+
display_name = local.azure_ad_group_names[count.index]
8484
}
8585

8686
data "azuread_user" "adusr" {
@@ -103,10 +103,10 @@ resource "azurerm_key_vault" "main" {
103103
enabled_for_deployment = var.enabled_for_deployment
104104
enabled_for_disk_encryption = var.enabled_for_disk_encryption
105105
enabled_for_template_deployment = var.enabled_for_template_deployment
106-
soft_delete_enabled = var.enable_soft_delete
106+
soft_delete_retention_days = var.soft_delete_retention_days
107+
enable_rbac_authorization = var.enable_rbac_authorization
107108
purge_protection_enabled = var.enable_purge_protection
108-
109-
tags = merge({ "ResourceName" = lower("kv-${var.key_vault_name}") }, var.tags, )
109+
tags = merge({ "ResourceName" = lower("kv-${var.key_vault_name}") }, var.tags, )
110110

111111
dynamic "network_acls" {
112112
for_each = var.network_acls != null ? [true] : []

variables.tf

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,21 @@ variable "enabled_for_template_deployment" {
2828
default = true
2929
}
3030

31-
variable "enable_soft_delete" {
32-
description = " Should Soft Delete be enabled for this Key Vault?"
33-
default = true
31+
variable "enable_rbac_authorization" {
32+
description = "Specify whether Azure Key Vault uses Role Based Access Control (RBAC) for authorization of data actions"
33+
default = false
3434
}
3535

3636
variable "enable_purge_protection" {
3737
description = "Is Purge Protection enabled for this Key Vault?"
3838
default = false
3939
}
4040

41+
variable "soft_delete_retention_days" {
42+
description = "The number of days that items should be retained for once soft-deleted. The valid value can be between 7 and 90 days"
43+
default = 90
44+
}
45+
4146
variable "access_policies" {
4247
description = "List of access policies for the Key Vault."
4348
default = []

versions.tf

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
terraform {
22
required_providers {
33
azuread = {
4-
source = "hashicorp/azuread"
4+
source = "hashicorp/azuread"
5+
version = ">= 1.4.0"
56
}
67
azurerm = {
78
source = "hashicorp/azurerm"
8-
version = "~>2.27.0"
9+
version = ">= 2.59.0"
910
}
1011
random = {
11-
source = "hashicorp/random"
12+
source = "hashicorp/random"
13+
version = ">= 3.1.0"
1214
}
1315
}
1416
required_version = ">= 0.13"

0 commit comments

Comments
 (0)