-
Notifications
You must be signed in to change notification settings - Fork 646
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
Refactor/cloud breach s3 #214
Refactor/cloud breach s3 #214
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added some comments to the PR to show changes
|
||
} | ||
#S3 Full Access Policy | ||
data "aws_iam_policy" "s3-full-access" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redundant
"Sid": "" | ||
Version = "2012-10-17", | ||
Statement = [ | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
jsonencode
|
||
#IAM Role Policy Attachment | ||
resource "aws_iam_role_policy_attachment" "cg-banking-WAF-Role-policy-attachment-s3" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redundant
from_port = 22 | ||
to_port = 22 | ||
protocol = "tcp" | ||
cidr_blocks = var.cg_whitelist | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
formatting
subnet_id = aws_subnet.cg-public-subnet-1.id | ||
associate_public_ip_address = true | ||
|
||
vpc_security_group_ids = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Formatting
default_tags = { | ||
Stack = var.stack-name | ||
Scenario = var.scenario-name | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Locals to combine default tags & other variables
bucket = "${aws_s3_bucket.cg-cardholder-data-bucket.id}" | ||
key = "cardholder_data_primary.csv" | ||
source = "../assets/cardholder_data_primary.csv" | ||
tags = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update aws_s3_bucket_object
-> aws_s3_object
Combined all objects into a single looped resources
@@ -1,32 +1,53 @@ | |||
#Required: AWS Profile | |||
variable "profile" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add type and description
version = "~> 4.16" | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add minimum TF versions (linting)
@@ -1,61 +1,63 @@ | |||
resource "aws_vpc" "cg-vpc" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
formatting
#Required: User's Public IP Address(es) | ||
variable "cg_whitelist" { | ||
default = "../whitelist.txt" | ||
description = "User's public IP address, pulled from the file ../whitelist.txt" | ||
default = ["0.0.0.0/0"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All IPs by default?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could switch this to something else (0.0.0.0/32
) Its more to switch to a default value that would be valid (list(string)
)
Overview of Changes
terraform fmt
Testing
Tested with version
1.2.0
&1.5.6
of Terraform