-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
skip: Merge branch 'policy_testing_2' into feature/policy_testing
- Loading branch information
Showing
28 changed files
with
257 additions
and
47 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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,9 @@ | ||
data "aws_ami" "this" { | ||
most_recent = true | ||
owners = ["amazon"] | ||
|
||
filter { | ||
name = "name" | ||
values = ["amzn2-ami-hvm*"] | ||
} | ||
} |
This file contains 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,12 @@ | ||
resource "aws_launch_configuration" "this" { | ||
name_prefix = "${module.naming.resource_prefix.launch_config}" | ||
image_id = data.aws_ami.this.id | ||
instance_type = "t2.micro" | ||
associate_public_ip_address = false | ||
|
||
metadata_options { | ||
http_endpoint = "enabled" | ||
http_tokens = "required" | ||
http_put_response_hop_limit = "1" | ||
} | ||
} |
This file contains 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,13 @@ | ||
module "naming" { | ||
source = "../../shared_tf_modules/naming" | ||
resource_type = basename(abspath(path.module)) | ||
status = title(basename(dirname(abspath(path.module)))) | ||
} | ||
|
||
data "terraform_remote_state" "common" { | ||
backend = "local" | ||
|
||
config = { | ||
path = "../common_resources/terraform.tfstate" | ||
} | ||
} |
This file contains 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,5 @@ | ||
output "launch" { | ||
value = { | ||
launch-config = aws_launch_configuration.this.name | ||
} | ||
} |
This file contains 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,16 @@ | ||
terraform { | ||
required_providers { | ||
aws = { | ||
source = "hashicorp/aws" | ||
version = "~> 5" | ||
} | ||
} | ||
} | ||
|
||
provider "aws" { | ||
region = var.region | ||
default_tags { | ||
tags = module.naming.default_tags | ||
} | ||
} | ||
|
This file contains 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,5 @@ | ||
variable "region" { | ||
type = string | ||
description = "Region where resources will be created" | ||
default = "us-east-1" | ||
} |
This file contains 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 @@ | ||
data "aws_caller_identity" "this" {} |
This file contains 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,13 @@ | ||
module "naming" { | ||
source = "../../shared_tf_modules/naming" | ||
resource_type = basename(abspath(path.module)) | ||
status = title(basename(dirname(abspath(path.module)))) | ||
} | ||
|
||
data "terraform_remote_state" "common" { | ||
backend = "local" | ||
|
||
config = { | ||
path = "../common_resources/terraform.tfstate" | ||
} | ||
} |
This file contains 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,5 @@ | ||
output "peering-connection" { | ||
value = { | ||
peering-connection = aws_vpc_peering_connection.this.id | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
auto_policy_testing/green/peering-connection/peering_connection.tf
This file contains 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,14 @@ | ||
resource "aws_vpc_peering_connection" "this" { | ||
peer_owner_id = data.aws_caller_identity.this.account_id | ||
peer_vpc_id = aws_vpc.vpc1.id | ||
vpc_id = aws_vpc.vpc2.id | ||
auto_accept = true | ||
} | ||
|
||
resource "aws_vpc" "vpc1" { | ||
cidr_block = "10.1.0.0/16" | ||
} | ||
|
||
resource "aws_vpc" "vpc2" { | ||
cidr_block = "10.2.0.0/16" | ||
} |
This file contains 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,16 @@ | ||
terraform { | ||
required_providers { | ||
aws = { | ||
source = "hashicorp/aws" | ||
version = "~> 5" | ||
} | ||
} | ||
} | ||
|
||
provider "aws" { | ||
region = var.region | ||
default_tags { | ||
tags = module.naming.default_tags | ||
} | ||
} | ||
|
This file contains 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,5 @@ | ||
variable "region" { | ||
type = string | ||
description = "Region where resources will be created" | ||
default = "us-east-1" | ||
} |
This file contains 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
This file contains 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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
output "directory" { | ||
value = { | ||
directory = aws_directory_service_directory.this.id | ||
directory = aws_directory_service_directory.this.id | ||
} | ||
} |
This file contains 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,9 @@ | ||
data "aws_ami" "this" { | ||
most_recent = true | ||
owners = ["amazon"] | ||
|
||
filter { | ||
name = "name" | ||
values = ["amzn2-ami-hvm*"] | ||
} | ||
} |
This file contains 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,25 @@ | ||
resource "aws_launch_configuration" "this" { | ||
name_prefix = "${module.naming.resource_prefix.launch_config}" | ||
image_id = data.aws_ami.this.id | ||
instance_type = "t2.micro" | ||
associate_public_ip_address = true | ||
|
||
# metadata_options { | ||
# http_endpoint = "enabled" | ||
# http_tokens = "required" | ||
# http_put_response_hop_limit = "5" | ||
# } | ||
} | ||
|
||
resource "aws_launch_configuration" "this2" { | ||
name_prefix = "${module.naming.resource_prefix.launch_config}-2" | ||
image_id = data.aws_ami.this.id | ||
instance_type = "t2.micro" | ||
associate_public_ip_address = true | ||
|
||
metadata_options { | ||
http_endpoint = "enabled" | ||
http_tokens = "required" | ||
http_put_response_hop_limit = "5" | ||
} | ||
} |
This file contains 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,13 @@ | ||
module "naming" { | ||
source = "../../shared_tf_modules/naming" | ||
resource_type = basename(abspath(path.module)) | ||
status = title(basename(dirname(abspath(path.module)))) | ||
} | ||
|
||
data "terraform_remote_state" "common" { | ||
backend = "local" | ||
|
||
config = { | ||
path = "../common_resources/terraform.tfstate" | ||
} | ||
} |
This file contains 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,6 @@ | ||
output "launch" { | ||
value = { | ||
launch-config = aws_launch_configuration.this.name | ||
ecc-aws-520-autoscaling_launch_config_hop_limit = aws_launch_configuration.this2.name | ||
} | ||
} |
This file contains 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,16 @@ | ||
terraform { | ||
required_providers { | ||
aws = { | ||
source = "hashicorp/aws" | ||
version = "~> 5" | ||
} | ||
} | ||
} | ||
|
||
provider "aws" { | ||
region = var.region | ||
default_tags { | ||
tags = module.naming.default_tags | ||
} | ||
} | ||
|
This file contains 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,5 @@ | ||
variable "region" { | ||
type = string | ||
description = "Region where resources will be created" | ||
default = "us-east-1" | ||
} |
This file contains 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 @@ | ||
data "aws_caller_identity" "this" {} |
This file contains 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,13 @@ | ||
module "naming" { | ||
source = "../../shared_tf_modules/naming" | ||
resource_type = basename(abspath(path.module)) | ||
status = title(basename(dirname(abspath(path.module)))) | ||
} | ||
|
||
data "terraform_remote_state" "common" { | ||
backend = "local" | ||
|
||
config = { | ||
path = "../common_resources/terraform.tfstate" | ||
} | ||
} |
This file contains 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,5 @@ | ||
output "peering-connection" { | ||
value = { | ||
peering-connection = aws_vpc_peering_connection.this.id | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
auto_policy_testing/red/peering-connection/peering_connection.tf
This file contains 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,15 @@ | ||
resource "aws_vpc_peering_connection" "this" { | ||
peer_owner_id = data.aws_caller_identity.this.account_id | ||
peer_vpc_id = aws_vpc.vpc1.id | ||
vpc_id = aws_vpc.vpc2.id | ||
auto_accept = true | ||
provider = aws.provider2 | ||
} | ||
|
||
resource "aws_vpc" "vpc1" { | ||
cidr_block = "10.1.0.0/16" | ||
} | ||
|
||
resource "aws_vpc" "vpc2" { | ||
cidr_block = "10.2.0.0/16" | ||
} |
This file contains 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,20 @@ | ||
terraform { | ||
required_providers { | ||
aws = { | ||
source = "hashicorp/aws" | ||
version = "~> 5" | ||
} | ||
} | ||
} | ||
|
||
provider "aws" { | ||
region = var.region | ||
default_tags { | ||
tags = module.naming.default_tags | ||
} | ||
} | ||
|
||
provider "aws" { | ||
region = var.region | ||
alias = "provider2" | ||
} |
This file contains 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,5 @@ | ||
variable "region" { | ||
type = string | ||
description = "Region where resources will be created" | ||
default = "us-east-1" | ||
} |
This file contains 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