mirror of
https://github.com/hashicorp/vault.git
synced 2026-02-03 20:40:45 -05:00
[QT-426] Always create the file audit directory (#20997)
* Always create the file audit directory * Create audit file directory after unsealing the leader
This commit is contained in:
parent
f0292fa2e4
commit
dbe41c4fee
1 changed files with 26 additions and 25 deletions
|
|
@ -217,31 +217,6 @@ resource "enos_vault_start" "followers" {
|
|||
}
|
||||
}
|
||||
|
||||
# We need to ensure that the directory used for audit logs is present and accessible to the vault
|
||||
# user on all nodes, since logging will only happen on the leader.
|
||||
resource "enos_remote_exec" "create_audit_log_dir" {
|
||||
depends_on = [
|
||||
enos_vault_start.followers,
|
||||
]
|
||||
for_each = toset([
|
||||
for idx, host in toset(local.instances) : idx
|
||||
if local.enable_audit_device
|
||||
])
|
||||
|
||||
environment = {
|
||||
LOG_FILE_PATH = local.audit_device_file_path
|
||||
SERVICE_USER = local.vault_service_user
|
||||
}
|
||||
|
||||
scripts = [abspath("${path.module}/scripts/create_audit_log_dir.sh")]
|
||||
|
||||
transport = {
|
||||
ssh = {
|
||||
host = var.target_hosts[each.value].public_ip
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
resource "enos_vault_init" "leader" {
|
||||
depends_on = [
|
||||
enos_vault_start.followers,
|
||||
|
|
@ -286,8 +261,34 @@ resource "enos_vault_unseal" "leader" {
|
|||
}
|
||||
}
|
||||
|
||||
# We need to ensure that the directory used for audit logs is present and accessible to the vault
|
||||
# user on all nodes, since logging will only happen on the leader.
|
||||
resource "enos_remote_exec" "create_audit_log_dir" {
|
||||
depends_on = [
|
||||
enos_vault_unseal.leader,
|
||||
]
|
||||
for_each = toset([
|
||||
for idx, host in toset(local.instances) : idx
|
||||
if var.enable_file_audit_device
|
||||
])
|
||||
|
||||
environment = {
|
||||
LOG_FILE_PATH = local.audit_device_file_path
|
||||
SERVICE_USER = local.vault_service_user
|
||||
}
|
||||
|
||||
scripts = [abspath("${path.module}/scripts/create_audit_log_dir.sh")]
|
||||
|
||||
transport = {
|
||||
ssh = {
|
||||
host = var.target_hosts[each.value].public_ip
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
resource "enos_remote_exec" "enable_file_audit_device" {
|
||||
depends_on = [
|
||||
enos_remote_exec.create_audit_log_dir,
|
||||
enos_vault_unseal.leader,
|
||||
]
|
||||
for_each = toset([
|
||||
|
|
|
|||
Loading…
Reference in a new issue