Skip to content

Commit

Permalink
Adding AWS IaC example
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonumiker-sysdig committed Apr 30, 2024
1 parent 963e0e3 commit 49a1076
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 1 deletion.
2 changes: 2 additions & 0 deletions aws-s3-terraform/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.terraform/
.terraform.lock.hcl
41 changes: 41 additions & 0 deletions aws-s3-terraform/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
terraform {
backend "s3" {
bucket = "jumiker-terraform"
key = "lwihkiak"
region = "ap-southeast-2"
}
}

provider "aws" {
region = "ap-southeast-2"
}

resource "aws_s3_bucket" "lwihkiak" {
bucket = "lwihkiak"
}

resource "aws_s3_bucket_ownership_controls" "lwihkiak" {
bucket = aws_s3_bucket.lwihkiak.id
rule {
object_ownership = "BucketOwnerPreferred"
}
}

resource "aws_s3_bucket_public_access_block" "lwihkiak" {
bucket = aws_s3_bucket.lwihkiak.id

block_public_acls = false
block_public_policy = false
ignore_public_acls = false
restrict_public_buckets = false
}

resource "aws_s3_bucket_acl" "lwihkiak" {
depends_on = [
aws_s3_bucket_ownership_controls.lwihkiak,
aws_s3_bucket_public_access_block.lwihkiak,
]

bucket = aws_s3_bucket.lwihkiak.id
acl = "public-read"
}
2 changes: 1 addition & 1 deletion scripts/refresh-security-playgrounds.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ kubectl delete --all pods --namespace=security-playground-restricted-nodrift
kubectl delete --all pods --namespace=security-playground-restricted-nomalware
kubectl delete -f ./generated-network-policy.yml
kubectl delete -f ./generated-network-policy2.yml
kubectl apply -f ../k8s-manifests/04-security-playground-deployment.yaml
kubectl apply -f example-scenarios/k8s-manifests/04-security-playground-deployment.yaml
1 change: 1 addition & 0 deletions scripts/test-all-workshop-commands.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#./example-curls-bucket-public.sh
#export SECURE_API_TOKEN=token
#./sysdig-cli-scanner -a app.au1.sysdig.com logstash:7.16.1
#./sysdig-cli-scanner -a app.au1.sysdig.com --iac example-scenarios/k8s-manifests/04-security-playground-deployment.yaml
./example-curls-networkpolicy.sh
kubectl apply -f ./generated-network-policy.yml
sleep 10
Expand Down

0 comments on commit 49a1076

Please sign in to comment.