1
1
# Postgres 15 flexible server store secrets in key vault
2
2
locals {
3
- flexible_secret_prefix_staging = " ${ var . component } -staging-db-flexible"
4
3
standard_secret_prefix = " ${ var . component } -POSTGRES"
5
4
6
5
flexible_secrets = [
@@ -25,32 +24,6 @@ locals {
25
24
value = local.db_name
26
25
}
27
26
]
28
-
29
- flexible_secrets_staging = var. env == " aat" ? [
30
- {
31
- name_suffix = " pass"
32
- value = module.postgresql- staging[0 ].password
33
- count = var.num_staging_dbs
34
- },
35
- {
36
- name_suffix = " host"
37
- value = module.postgresql- staging[0 ].fqdn
38
- count = var.num_staging_dbs
39
- },
40
- {
41
- name_suffix = " user"
42
- value = module.postgresql- staging[0 ].username
43
- count = var.num_staging_dbs
44
- },
45
- {
46
- name_suffix = " port"
47
- value = " 5432"
48
- },
49
- {
50
- name_suffix = " database"
51
- value = local.db_name
52
- }
53
- ]: []
54
27
}
55
28
56
29
resource "azurerm_key_vault_secret" "flexible_secret_standard_format" {
@@ -64,15 +37,3 @@ resource "azurerm_key_vault_secret" "flexible_secret_standard_format" {
64
37
content_type = " "
65
38
expiration_date = timeadd (timestamp (), " 17520h" )
66
39
}
67
-
68
- resource "azurerm_key_vault_secret" "flexible_secret_staging" {
69
- for_each = { for secret in local . flexible_secrets_staging : secret . name_suffix => secret }
70
- key_vault_id = data. azurerm_key_vault . key_vault . id
71
- name = " ${ local . flexible_secret_prefix_staging } -${ each . value . name_suffix } "
72
- value = each. value . value
73
- tags = merge (var. common_tags , {
74
- " source" : " ${ var . component } PostgreSQL"
75
- })
76
- content_type = " "
77
- expiration_date = timeadd (timestamp (), " 17520h" )
78
- }
0 commit comments