-
Notifications
You must be signed in to change notification settings - Fork 9
Terraform docker splunk deployment #124
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
Open
CSL-Answer
wants to merge
35
commits into
develop
Choose a base branch
from
terraform-docker-splunk-deployment
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 3 commits
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
b20d8ff
First completed draft of splunk terraform file.
CSL-Answer afe2d74
Fixed source urls for modules
CSL-Answer 46356d1
splunk config now successfully runs a splunk instance
CSL-Answer b9e07db
code style ammendments
CSL-Answer 7fb54f5
moved splunk variables to local folder for the splunk terraform code,…
CSL-Answer 05b9eb8
Added checkov skip comments to avoid the unneeded analysis errors
CSL-Answer 5d3154d
Bump Microsoft.AspNetCore.Mvc.Testing from 7.0.3 to 7.0.4 (#125)
dependabot[bot] fe16d30
Bump Alba from 7.3.0 to 7.4.0 (#126)
dependabot[bot] 0559494
Bump AWSSDK.CloudWatchLogs from 3.7.104.33 to 3.7.104.40 (#128)
dependabot[bot] 4391999
successfully applied however, broke current splunk instance
CSL-Answer 64facca
updated route 53 record code
CSL-Answer 1b0f2bf
subnet mapping now configured for one subnet
CSL-Answer 5f423d6
Added S3 bucket for splunk
CSL-Answer 1cf066e
Added back certificate and reference. Ammended properties pointed out…
CSL-Answer da1b104
Added 8000 to ec2 sg. Added certificate validation
CSL-Answer 326b58b
added eip sg to ec2 setup
CSL-Answer f70c276
Fixed s3 backend
bethcryer 06ff32e
switched to ALB, still not workin :(
bethcryer bbd6a45
hi :)
bethcryer e4867a6
Merge branch 'terraform-docker-splunk-deployment' of https://github.c…
5373000
reverted indentation in bash script
81ac819
changed ports in security group
30015bc
removed docker provider
CSL-Answer 572da90
s3 access logs and related config added
CSL-Answer 5b8fcbc
enabled deletion protection for load balancer
CSL-Answer d2c53e7
Added skip for aws autoscaling EC2 launch template checkov check
CSL-Answer 7a6f5d9
Skipped checkov check for S3 bucket event notifications
CSL-Answer a10a2ed
Skipped check for EC2 lanch templates for the aws_autoscaling_group r…
CSL-Answer a91ff96
Checkov check for KMS encryption on S3 buckets has been skipped. Will…
CSL-Answer c0d6e37
Added checkov skips for the elb_logs resource
CSL-Answer 68d7a0d
Set associate public ip address to false for the splunk ec2 instance
CSL-Answer ec869d2
Load balancer for splunk is not using TLS 1.2
CSL-Answer fca116d
Added versioning for the elb logs s3 bucket
CSL-Answer 33f9c62
updated ec2 instance set up to use the new version 2.1.0 for the ec2 …
CSL-Answer 6936d3d
Successfully applies with ec2 update
CSL-Answer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| # Just putting everything in on file for now, will move around afterwards | ||
|
|
||
| # variables | ||
| variable "splunk_project_name" { | ||
| type = string | ||
| description = "Splunk Project Name" | ||
| default = "answerking-splunk-instance" | ||
| } | ||
|
|
||
| variable "splunk_project_owner" { | ||
| type = string | ||
| description = "Splunk Resource Owner" | ||
| default = "answerking" | ||
| } | ||
|
|
||
| module "splunk_vpc_subnet" { | ||
bethcryer marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| source = "git::https://github.com/answerdigital/terraform-modules//Terraform_modules/vpc_subnets?ref=v1.0.0" | ||
| owner = var.splunk_project_owner | ||
| project_name = var.splunk_project_name | ||
| azs = ["eu-west-2a"] | ||
bethcryer marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| #enable_vpc_flow_logs = true | ||
| } | ||
|
|
||
| data "aws_ami" "amazon_linux_2" { | ||
| most_recent = true | ||
| owners = ["amazon"] | ||
|
|
||
| filter { | ||
| name = "name" | ||
| values = ["amzn2-ami-hvm-*-x86_64-ebs"] | ||
| } | ||
| } | ||
|
|
||
| resource "aws_security_group" "ec2_sg" { | ||
| name = "${var.splunk_project_name}-ec2_sg" | ||
bethcryer marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| description = "Security group for ec2_sg" | ||
| vpc_id = module.splunk_vpc_subnet.vpc_id | ||
|
|
||
| ingress { | ||
bethcryer marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| from_port = 80 | ||
| to_port = 80 | ||
| protocol = "tcp" | ||
| cidr_blocks = ["0.0.0.0/0"] | ||
| } | ||
|
|
||
| ingress { | ||
| from_port = 443 | ||
| to_port = 443 | ||
| protocol = "tcp" | ||
| cidr_blocks = ["0.0.0.0/0"] | ||
| } | ||
|
|
||
| egress { | ||
| from_port = 0 | ||
| to_port = 0 | ||
| protocol = "-1" | ||
| cidr_blocks = ["0.0.0.0/0"] | ||
| } | ||
|
|
||
| tags = { | ||
| Name = "${var.splunk_project_name}-ec2-sg" | ||
| Owner = var.splunk_project_owner | ||
| } | ||
| } | ||
|
|
||
| module "ec2_instance_setup" { | ||
| source = "git::https://github.com/AnswerConsulting/AnswerKing-Infrastructure.git//Terraform_modules/ec2_instance?ref=v1.0.0" | ||
| project_name = "answerking-splunk-instance" | ||
| owner = "answerking" | ||
bethcryer marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ami_id = data.aws_ami.amazon_linux_2.id | ||
| availability_zone = "eu-west-2a" | ||
| subnet_id = module.splunk_vpc_subnet.public_subnet_ids[0] | ||
| vpc_security_group_ids = [aws_security_group.ec2_sg.id] | ||
| needs_elastic_ip = true | ||
| user_data = <<EOF | ||
| #!/bin/bash -xe | ||
| #logs all user_data commands into a user-data.log file | ||
| exec > >(tee /var/log/user-data.log|logger -t user-data -s 2>/dev/console) 2>&1 | ||
|
|
||
| sudo yum update -y | ||
| sudo yum upgrade -y | ||
| sudo yum install docker -y | ||
| sudo systemctl enable docker.service | ||
| sudo systemctl start docker.service | ||
|
|
||
| sudo docker pull splunk/splunk:latest | ||
| sudo docker run -d -p 80:8000 -e "SPLUNK_START_ARGS=--accept-license" -e "SPLUNK_PASSWORD={password}" --name splunk splunk/splunk:latest | ||
| EOF | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.