Skip to content

Instantly share code, notes, and snippets.

@devops-adeel
Last active November 15, 2022 10:20
Show Gist options
  • Save devops-adeel/9f4d73924308fc623fe98d3e2f86c2e1 to your computer and use it in GitHub Desktop.
Save devops-adeel/9f4d73924308fc623fe98d3e2f86c2e1 to your computer and use it in GitHub Desktop.
Vault Baseline Configuration
resource "vault_audit" "file" {
type = "file"
description = "Vault Audit to File"
options = {
file_path = "/var/log/vault_audit.log"
format = "json"
mode = "0000"
prefix = "vault"
}
}
resource "vault_audit" "syslog" {
type = "syslog"
description = "Vault Audit to syslog"
options = {
tag = "vault"
facility = "AUTH"
format = "json"
prefix = "vault"
}
}
#https://developer.hashicorp.com/vault/api-docs/system/storage/raftautopilot#set-configuration
#https://developer.hashicorp.com/vault/tutorials/raft/raft-autopilot#autopilot-configuration
resource "vault_raft_autopilot" "default" {
cleanup_dead_servers = true
dead_server_last_contact_threshold = "10s"
last_contact_threshold = "10s"
max_trailing_logs = 1000
min_quorum = 3
server_stabilization_time = "10s"
}
resource "vault_raft_snapshot_agent_config" "local" {
name = "local"
interval_seconds = 86400
retain = 7
path_prefix = "/opt/vault/snapshots/"
storage_type = "local"
local_max_space = 10000000
}
#AWS
data "aws_region" "default" {}
resource "vault_raft_snapshot_agent_config" "aws" {
name = "s3"
interval_seconds = 86400
retain = 7
path_prefix = "/vault/snapshots/"
storage_type = "aws-s3"
aws_s3_bucket = "vault_snapshots"
aws_s3_region = data.aws_region.default.name
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment