Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport of [QT-426] Always create the file audit directory into release/1.11.x #21004

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 26 additions & 25 deletions enos/modules/vault_cluster/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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([
Expand Down