Skip to content
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

Prisma Cloud has created this PR to tag your IaC to Cloud resources. #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions terraform/aws/keypair/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ variable "public_key_filename" { default = "~/.ssh/id_rsa_aws.pub" }
resource "aws_key_pair" "default" {
key_name = "${var.short_name}"
public_key = "${file(var.public_key_filename)}"
tags = {
yor_trace = "da357308-e844-46cf-8442-49497d82385d"
}
}

# output variables
Expand Down
14 changes: 9 additions & 5 deletions terraform/aws/private-cloud/bastion-server.tf
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,19 @@ resource "template_file" "bastion_cloud_init" {
}

resource "aws_instance" "bastion" {
instance_type = "${var.bastion_instance_type}"
ami = "${module.bastion_ami.ami_id}"
instance_type = "${var.bastion_instance_type}"
ami = "${module.bastion_ami.ami_id}"
# Just put the bastion in the first public subnet
subnet_id = "${element(split(",", module.vpc.public_subnets), 0)}"
subnet_id = "${element(split(",", module.vpc.public_subnets), 0)}"
# @todo - this allows bastion connection on any port which is not ideal but was like this previously.
security_groups = ["${module.sg-default.security_group_id}", "${aws_security_group.bastion.id}"]
key_name = "${module.aws-keypair.keypair_name}"
source_dest_check = false
user_data = "${template_file.bastion_cloud_init.rendered}"
tags = {
Name = "apollo-mesos-bastion"
role = "bastion"
Name = "apollo-mesos-bastion"
role = "bastion"
yor_trace = "9606a32f-bbd4-4449-8f42-fbd3503bfefd"
}
connection {
user = "core"
Expand Down Expand Up @@ -66,4 +67,7 @@ resource "aws_instance" "bastion" {
resource "aws_eip" "bastion" {
instance = "${aws_instance.bastion.id}"
vpc = true
tags = {
yor_trace = "d0914d70-3d7a-48a7-8175-912f1b27c7d7"
}
}
13 changes: 7 additions & 6 deletions terraform/aws/private-cloud/mesos-agents.tf
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,14 @@ resource "aws_instance" "mesos-agent" {
key_name = "${module.aws-keypair.keypair_name}"
source_dest_check = false
# @todo - fix this as this only allows 3 agents maximum (due to splittingo on the count variable)
subnet_id = "${element(split(",", module.vpc.private_subnets), count.index)}"
security_groups = ["${module.sg-default.security_group_id}"]
depends_on = ["aws_instance.bastion", "aws_instance.mesos-master"]
user_data = "${template_file.master_cloud_init.rendered}"
subnet_id = "${element(split(",", module.vpc.private_subnets), count.index)}"
security_groups = ["${module.sg-default.security_group_id}"]
depends_on = ["aws_instance.bastion", "aws_instance.mesos-master"]
user_data = "${template_file.master_cloud_init.rendered}"
tags = {
Name = "apollo-mesos-agent-${count.index}"
role = "mesos_agents"
Name = "apollo-mesos-agent-${count.index}"
role = "mesos_agents"
yor_trace = "2e009ac2-8d94-41d1-bfd5-1ea3531c2911"
}
connection {
user = "core"
Expand Down
5 changes: 3 additions & 2 deletions terraform/aws/private-cloud/mesos-masters.tf
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ resource "aws_instance" "mesos-master" {
depends_on = ["aws_instance.bastion"]
user_data = "${template_file.master_cloud_init.rendered}"
tags = {
Name = "apollo-mesos-master-${count.index}"
role = "mesos_masters"
Name = "apollo-mesos-master-${count.index}"
role = "mesos_masters"
yor_trace = "7e7a3e78-ac49-4e96-8334-9c3c6b216660"
}
connection {
user = "core"
Expand Down
3 changes: 3 additions & 0 deletions terraform/aws/private-cloud/security_groups.tf
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,7 @@ resource "aws_security_group" "bastion" {
tags {
Name = "bastion-apollo-sg"
}
tags = {
yor_trace = "cf1d82f1-4772-4b6a-b5bb-16a8f33b5157"
}
}
34 changes: 26 additions & 8 deletions terraform/aws/private-cloud/vpc/main.tf
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
variable "name" { }
variable "cidr" { }
variable "name" {}
variable "cidr" {}
variable "public_subnets" { default = "" }
variable "private_subnets" { default = "" }
variable "bastion_instance_id" { }
variable "azs" { }
variable "bastion_instance_id" {}
variable "azs" {}
variable "enable_dns_hostnames" {
description = "should be true if you want to use private DNS within the VPC"
default = false
default = false
}
variable "enable_dns_support" {
description = "should be true if you want to use private DNS within the VPC"
default = false
default = false
}

# resources
Expand All @@ -21,21 +21,30 @@ resource "aws_vpc" "mod" {
tags {
Name = "${var.name}"
}
tags = {
yor_trace = "97db6332-f675-423f-9f28-895332aaaac0"
}
}

resource "aws_internet_gateway" "mod" {
vpc_id = "${aws_vpc.mod.id}"
tags = {
yor_trace = "2b913cf2-4a82-422c-9c10-7b89b85f54d8"
}
}

resource "aws_route_table" "public" {
vpc_id = "${aws_vpc.mod.id}"
route {
cidr_block = "0.0.0.0/0"
gateway_id = "${aws_internet_gateway.mod.id}"
cidr_block = "0.0.0.0/0"
gateway_id = "${aws_internet_gateway.mod.id}"
}
tags {
Name = "${var.name}-public"
}
tags = {
yor_trace = "598b8c63-05a7-4c78-a8e7-2a100e03efce"
}
}

resource "aws_route_table" "private" {
Expand All @@ -47,6 +56,9 @@ resource "aws_route_table" "private" {
tags {
Name = "${var.name}-private"
}
tags = {
yor_trace = "9ca9dcc2-05c2-430f-8770-9721576e6d29"
}
}

resource "aws_subnet" "private" {
Expand All @@ -57,6 +69,9 @@ resource "aws_subnet" "private" {
tags {
Name = "${var.name}-private"
}
tags = {
yor_trace = "8f8da41a-8e3d-4a93-bc03-423f724ad49d"
}
}

resource "aws_subnet" "public" {
Expand All @@ -69,6 +84,9 @@ resource "aws_subnet" "public" {
}

map_public_ip_on_launch = true
tags = {
yor_trace = "fb8ada78-3a4f-4832-afe3-ab0012f38a4b"
}
}

resource "aws_route_table_association" "private" {
Expand Down
5 changes: 3 additions & 2 deletions terraform/aws/public-cloud/mesos-agents.tf
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ resource "aws_instance" "mesos-agent" {
depends_on = ["aws_instance.mesos-master"]
user_data = "${template_file.agent_cloud_init.rendered}"
tags = {
Name = "apollo-mesos-agent-${count.index}"
role = "mesos_agents"
Name = "apollo-mesos-agent-${count.index}"
role = "mesos_agents"
yor_trace = "174efd1b-6b80-44f2-b8fd-910f211a0e3c"
}
ebs_block_device {
device_name = "/dev/xvdb"
Expand Down
5 changes: 3 additions & 2 deletions terraform/aws/public-cloud/mesos-masters.tf
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ resource "aws_instance" "mesos-master" {
security_groups = ["${module.sg-default.security_group_id}"]
user_data = "${template_file.master_cloud_init.rendered}"
tags = {
Name = "apollo-mesos-master-${count.index}"
role = "mesos_masters"
Name = "apollo-mesos-master-${count.index}"
role = "mesos_masters"
yor_trace = "9088c15c-a2fb-4831-bef2-31b6363dcfdb"
}
}
3 changes: 3 additions & 0 deletions terraform/aws/sg-all-traffic/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ resource "aws_security_group" "default" {
tags {
Name = "apollo-default-sg"
}
tags = {
yor_trace = "6b4a3dda-0b87-46c9-84bf-9e9428e4480e"
}
}

# output variables
Expand Down
39 changes: 21 additions & 18 deletions terraform/gce/mesos-agent.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,27 @@ resource "atlas_artifact" "mesos-agent" {
}

resource "google_compute_instance" "mesos-agent" {
count = "${var.agents}"
name = "apollo-mesos-agent-${count.index}"
machine_type = "${var.instance_type.agent}"
zone = "${var.zone}"
tags = ["mesos-agent","http","https","ssh"]
count = "${var.agents}"
name = "apollo-mesos-agent-${count.index}"
machine_type = "${var.instance_type.agent}"
zone = "${var.zone}"
tags = ["mesos-agent", "http", "https", "ssh"]

disk {
image = "${atlas_artifact.mesos-agent.id}"
}

metadata {
role = "mesos_agents"
}
disk {
image = "${atlas_artifact.mesos-agent.id}"
}

network_interface {
network = "default"
access_config {
// Ephemeral IP
}
}
metadata {
role = "mesos_agents"
}

network_interface {
network = "default"
access_config {
// Ephemeral IP
}
}
labels = {
yor_trace = "88562c80-c854-4c62-b824-567a90dda89e"
}
}
71 changes: 37 additions & 34 deletions terraform/gce/mesos-master.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,46 +7,49 @@ resource "atlas_artifact" "mesos-master" {
}

resource "google_compute_instance" "mesos-master" {
count = "${var.masters}"
name = "apollo-mesos-master-${count.index}"
machine_type = "${var.instance_type.master}"
zone = "${var.zone}"
tags = ["mesos-master"]

disk {
image = "${atlas_artifact.mesos-master.id}"
}

# declare metadata for configuration of the node
metadata {
role = "mesos_masters"
count = "${var.masters}"
name = "apollo-mesos-master-${count.index}"
machine_type = "${var.instance_type.master}"
zone = "${var.zone}"
tags = ["mesos-master"]

disk {
image = "${atlas_artifact.mesos-master.id}"
}

# declare metadata for configuration of the node
metadata {
role = "mesos_masters"
}

network_interface {
network = "default"
access_config {
// Ephemeral IP
}

network_interface {
network = "default"
access_config {
// Ephemeral IP
}
}
}
labels = {
yor_trace = "c592b38f-a0e8-42d7-ab4a-55fbe2ef6393"
}
}

resource "google_compute_firewall" "default" {
name = "default-allow-all"
network = "default"
name = "default-allow-all"
network = "default"

allow {
protocol = "icmp"
}
allow {
protocol = "icmp"
}

allow {
protocol = "tcp"
ports = ["1-65535"]
}
allow {
protocol = "tcp"
ports = ["1-65535"]
}

allow {
protocol = "udp"
ports = ["1-65535"]
}
allow {
protocol = "udp"
ports = ["1-65535"]
}

source_ranges = ["0.0.0.0/0"]
source_ranges = ["0.0.0.0/0"]
}