How susin0811/es-splunk works
Purpose and Entry Points
This repository is an infrastructure-as-code package that deploys a distributed Splunk Enterprise 9.3 / Enterprise Security environment on AWS. Terraform is the primary control plane: terraform/main.tf composes the deployment, while scripts/deploy.sh and scripts/deploy.ps1 wrap Terraform plan/apply/output workflows. Post-provisioning operations use scripts/install-es-app.sh and scripts/health-check.sh.
Root Composition and Configuration Boundary
terraform/main.tf wires VPC, security, S3, and Splunk compute modules into one AWS stack. Inputs—including region, EC2 key pair, Splunk artifact URI, admin password, CIDR restrictions, SmartStore, ALB, and bastion toggles—are defined in terraform/variables.tf; exported access endpoints and deployment metadata are in terraform/outputs.tf. terraform/terraform.tfvars.example is the operator-facing configuration template.
Network and Access Layer
The VPC module establishes the isolated AWS network, including subnets and NAT routing, in terraform/modules/vpc/main.tf. Security groups and permitted Splunk/UI/management traffic are defined in terraform/modules/security/main.tf. Splunk nodes are intended to remain private; a bastion and optional ALB provide controlled administrative or web entry paths.
Storage and Artifact Layer
terraform/modules/s3/main.tf creates private S3 storage for two distinct concerns: Splunk installation artifacts and SmartStore-backed data tiers. The deployment consumes an externally supplied Splunk Enterprise tarball URI, so artifact upload/prestaging is an operator responsibility. AWS IAM permissions created by the compute module allow Splunk infrastructure to access these buckets.
Splunk Compute Topology
terraform/modules/splunk/main.tf provisions the EC2/IAM/optional ALB layer for the distributed deployment:
• Search Head: Splunk Web, search processing, and Enterprise Security runtime.
• Two indexers: ingestion and replicated/searchable data storage, configured for RF=2 and SF=2.
• Cluster Manager combined with Deployment Server: indexer-cluster coordination plus app/config distribution.
• Optional bastion access and ALB exposure are infrastructure-level features of this layer.
AWS EC2, EBS, IAM, Secrets Manager, S3, VPC, and optionally ALB are material runtime dependencies.
Bootstrap and Cluster Formation
EC2 user-data templates install and configure Splunk during instance initialization. terraform/modules/splunk/templates/user-data-cluster-manager.sh.tpl establishes the cluster-management/deployment-server role; terraform/modules/splunk/templates/user-data-indexer.sh.tpl connects indexers to that manager and applies clustered-storage setup; terraform/modules/splunk/templates/user-data-search-head.sh.tpl configures the Search Head to operate against the indexer tier. Bootstrap failures are surfaced through instance-side logs rather than an application runtime in this repository.
Operational Lifecycle and External Boundaries
Terraform provisions only Splunk Enterprise infrastructure; Enterprise Security itself is separately licensed and supplied as an external .spl/.tgz package. scripts/install-es-app.sh performs the post-deployment ES installation through the deployed environment, after which operators license and configure ES in Splunk Web. scripts/health-check.sh validates the reachable cluster after bootstrap. AWS credentials, a preexisting EC2 key pair, Splunk binaries, licenses, and the ES package remain external prerequisites.
Main entry points: terraform/main.tf Terraform stack · splunk/main.tf EC2, IAM and ingress · s3/main.tf Artifact and SmartStore S3 · user-data-indexer.sh.tpl Indexer cluster
Components 17
Control Plane
Terraform composition and operator workflows.
- Terraform stack · Composes the AWS and Splunk modules.
terraform/main.tf - Deployment inputs · Defines topology, access, artifact, and feature toggles.
terraform/variables.tf - Access outputs · Exports endpoints and deployment metadata.
terraform/outputs.tf - Operator config template
terraform/terraform.tfvars.example - Deploy wrappers · Run Terraform plan, apply, and output workflows.
scripts/deploy.sh - ES installation · Installs ES through the deployed environment.
scripts/install-es-app.sh - Cluster health check · Validates reachable cluster health.
scripts/health-check.sh
AWS Foundation
Network, storage, and infrastructure access.
- Private VPC · Creates subnets and NAT routing.
terraform/modules/vpc/main.tf - Security groups · Controls Splunk UI and management traffic.
terraform/modules/security/main.tf - Artifact and SmartStore S3 · Creates private buckets for binaries and data tiers.
terraform/modules/s3/main.tf - EC2, IAM and ingress · Provisions EC2, EBS, IAM, optional bastion, and optional ALB.
terraform/modules/splunk/main.tf
Splunk Topology
Private distributed Enterprise deployment.
- Cluster Manager + DS · Coordinates indexers and distributes apps/configuration.
terraform/modules/splunk/templates/user-data-cluster-manager.sh.tpl - Indexer cluster · RF=2/SF=2 ingestion and searchable storage tier.
terraform/modules/splunk/templates/user-data-indexer.sh.tpl - Search Head · Hosts Splunk Web and search processing.
terraform/modules/splunk/templates/user-data-search-head.sh.tpl
External Prerequisites
Operator-supplied dependencies and post-deployment software.
- Splunk Enterprise tarball · Operator prestages the supplied binary URI.
- AWS credentials and key pair
- Enterprise Security package · Separately supplied and licensed .spl or .tgz package.
Connections 22
- Operator config template → Deployment inputs: supplies values
- Deploy wrappers → Terraform stack: plan/apply
- Deployment inputs → Terraform stack: configures
- Terraform stack → Access outputs: exports
- Terraform stack → Private VPC: provisions
- Terraform stack → Security groups: provisions
- Terraform stack → Artifact and SmartStore S3: provisions
- Terraform stack → EC2, IAM and ingress: provisions
- AWS credentials and key pair → Deploy wrappers: authenticates deployment
- Splunk Enterprise tarball → Artifact and SmartStore S3: prestaged for bootstrap
- Private VPC → EC2, IAM and ingress: private network
- Security groups → EC2, IAM and ingress: traffic policy
- Artifact and SmartStore S3 → EC2, IAM and ingress: IAM-backed bucket access
- EC2, IAM and ingress → Cluster Manager + DS: bootstraps
- EC2, IAM and ingress → Indexer cluster: bootstraps
- EC2, IAM and ingress → Search Head: bootstraps
- Cluster Manager + DS → Indexer cluster: forms and manages cluster
- Indexer cluster → Search Head: searchable data
- Artifact and SmartStore S3 → Indexer cluster: SmartStore tier
- Enterprise Security package → ES installation: supplies package
- ES installation → Search Head: installs ES
- Cluster health check → Search Head: validates cluster