Skip to content

Commit

Permalink
updated-repetitive-values-by-local
Browse files Browse the repository at this point in the history
  • Loading branch information
1Harmeetsingh committed Jul 8, 2024
1 parent 3ff4d02 commit 1609940
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 40 deletions.
32 changes: 17 additions & 15 deletions examples/ec2-network-mode-awsvpc/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ provider "aws" {
locals {
vpc_cidr_block = module.vpc.vpc_cidr_block
additional_cidr_block = "172.16.0.0/16"
environment = "test"
label_order = ["name", "environment"]
}
##---------------------------------------------------------------------------------------------------------------------------
## A key pair is a combination of a public key that is used to encrypt data and a private key that is used to decrypt data.
Expand All @@ -17,7 +19,7 @@ module "keypair" {
version = "1.3.1"

name = "key"
environment = "test"
environment = local.environment
label_order = ["environment", "name"]
public_key = ""
create_private_key_enabled = true
Expand All @@ -33,8 +35,8 @@ module "vpc" {

name = "vpc"
repository = "https://github.com/clouddrove/terraform-aws-vpc"
environment = "test"
label_order = ["name", "environment"]
environment = local.environment
label_order = local.label_order
cidr_block = "10.10.0.0/16"
}

Expand All @@ -47,8 +49,8 @@ module "subnets" {

name = "subnets"
repository = "https://github.com/clouddrove/terraform-aws-subnet"
environment = "test"
label_order = ["name", "environment"]
environment = local.environment
label_order = local.label_order
nat_gateway_enabled = true
availability_zones = ["eu-west-1a", "eu-west-1b"]
vpc_id = module.vpc.vpc_id
Expand All @@ -67,8 +69,8 @@ module "ssh" {
version = "2.0.0"

name = "ssh"
environment = "test"
label_order = ["name", "environment"]
environment = local.environment
label_order = local.label_order
vpc_id = module.vpc.vpc_id
new_sg_ingress_rules_with_cidr_blocks = [{
rule_count = 1
Expand All @@ -95,8 +97,8 @@ module "http_https" {
version = "2.0.0"

name = "http-https"
environment = "test"
label_order = ["name", "environment"]
environment = local.environment
label_order = local.label_order

vpc_id = module.vpc.vpc_id
## INGRESS Rules
Expand Down Expand Up @@ -148,8 +150,8 @@ module "kms_key" {

name = "kms"
repository = "https://github.com/clouddrove/terraform-aws-kms"
environment = "test"
label_order = ["name", "environment"]
environment = local.environment
label_order = local.label_order
enabled = true
description = "KMS key for ecs"
alias = "alias/ecs"
Expand Down Expand Up @@ -184,8 +186,8 @@ module "acm" {
version = "1.4.1"

name = "certificate"
environment = "test"
label_order = ["name", "environment"]
environment = local.environment
label_order = local.label_order

enable_aws_certificate = true
enable_dns_validation = false
Expand All @@ -203,8 +205,8 @@ module "ecs" {
## Tags
name = "ecs-awsvpc"
repository = "https://github.com/clouddrove/terraform-aws-ecs"
environment = "test"
label_order = ["name", "environment"]
environment = local.environment
label_order = local.label_order
enabled = true # set to true after VPC, Subnets, Security Groups, KMS Key and Key Pair gets created

## Network
Expand Down
32 changes: 17 additions & 15 deletions examples/ec2-network-mode-bridge/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ provider "aws" {
locals {
vpc_cidr_block = module.vpc.vpc_cidr_block
additional_cidr_block = "172.16.0.0/16"
environment = "test"
label_order = ["name", "environment"]
}
##---------------------------------------------------------------------------------------------------------------------------
## A key pair is a combination of a public key that is used to encrypt data and a private key that is used to decrypt data.
Expand All @@ -17,7 +19,7 @@ module "keypair" {
version = "1.3.1"

name = "key"
environment = "test"
environment = local.environment
label_order = ["environment", "name"]
public_key = ""
create_private_key_enabled = true
Expand All @@ -33,8 +35,8 @@ module "vpc" {

name = "vpc"
repository = "https://github.com/clouddrove/terraform-aws-vpc"
environment = "test"
label_order = ["name", "environment"]
environment = local.environment
label_order = local.label_order
cidr_block = "10.10.0.0/16"
}

Expand All @@ -47,8 +49,8 @@ module "subnets" {

name = "subnets"
repository = "https://github.com/clouddrove/terraform-aws-subnet"
environment = "test"
label_order = ["name", "environment"]
environment = local.environment
label_order = local.label_order
nat_gateway_enabled = true
availability_zones = ["eu-west-1a", "eu-west-1b"]
vpc_id = module.vpc.vpc_id
Expand All @@ -67,8 +69,8 @@ module "ssh" {
version = "2.0.0"

name = "ssh"
environment = "test"
label_order = ["name", "environment"]
environment = local.environment
label_order = local.label_order
vpc_id = module.vpc.vpc_id
new_sg_ingress_rules_with_cidr_blocks = [{
rule_count = 1
Expand Down Expand Up @@ -96,8 +98,8 @@ module "http_https" {
version = "2.0.0"

name = "http-https"
environment = "test"
label_order = ["name", "environment"]
environment = local.environment
label_order = local.label_order

vpc_id = module.vpc.vpc_id
## INGRESS Rules
Expand Down Expand Up @@ -149,8 +151,8 @@ module "kms_key" {

name = "kms"
repository = "https://github.com/clouddrove/terraform-aws-kms"
environment = "test"
label_order = ["name", "environment"]
environment = local.environment
label_order = local.label_order
enabled = true
description = "KMS key for ecs"
alias = "alias/ecs"
Expand Down Expand Up @@ -184,8 +186,8 @@ module "acm" {
version = "1.4.1"

name = "certificate"
environment = "test"
label_order = ["name", "environment"]
environment = local.environment
label_order = local.label_order

enable_aws_certificate = true
domain_name = "clouddrove.ca"
Expand All @@ -203,8 +205,8 @@ module "ecs" {
## Tags
name = "ecs-bridge"
repository = "https://github.com/clouddrove/terraform-aws-ecs"
environment = "test"
label_order = ["name", "environment"]
environment = local.environment
label_order = local.label_order
enabled = true # set to true after VPC, Subnets, Security Groups, KMS Key and Key Pair gets created

## Network
Expand Down
22 changes: 12 additions & 10 deletions examples/fargate/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ provider "aws" {
locals {
vpc_cidr_block = module.vpc.vpc_cidr_block
additional_cidr_block = "172.16.0.0/16"
environment = "test"
label_order = ["name", "environment"]
}
##---------------------------------------------------------------------------------------------------------------------------
## A VPC is a virtual network that closely resembles a traditional network that you'd operate in your own data center.
Expand All @@ -18,8 +20,8 @@ module "vpc" {

name = "vpc"
repository = "https://github.com/clouddrove/terraform-aws-vpc"
environment = "test"
label_order = ["name", "environment"]
environment = local.environment
label_order = local.label_order
cidr_block = "10.10.0.0/16"
}

Expand All @@ -32,8 +34,8 @@ module "subnets" {

name = "subnets"
repository = "https://github.com/clouddrove/terraform-aws-subnet"
environment = "test"
label_order = ["name", "environment"]
environment = local.environment
label_order = local.label_order
nat_gateway_enabled = true
availability_zones = ["eu-west-1a", "eu-west-1b"]
vpc_id = module.vpc.vpc_id
Expand All @@ -52,8 +54,8 @@ module "sg_lb" {
version = "2.0.0"

name = "ssh"
environment = "test"
label_order = ["name", "environment"]
environment = local.environment
label_order = local.label_order
vpc_id = module.vpc.vpc_id
new_sg_ingress_rules_with_cidr_blocks = [{
rule_count = 1
Expand Down Expand Up @@ -83,8 +85,8 @@ module "acm" {
version = "1.4.1"

name = "certificate"
environment = "test"
label_order = ["name", "environment"]
environment = local.environment
label_order = local.label_order

enable_aws_certificate = true
domain_name = "clouddrove.ca"
Expand All @@ -102,8 +104,8 @@ module "ecs" {
## Tags
name = "ecs-fargate"
repository = "https://github.com/clouddrove/terraform-aws-ecs"
environment = "test"
label_order = ["name", "environment"]
environment = local.environment
label_order = local.label_order
enabled = true # set to true after VPC, Subnets and Security Groups gets created

## Network
Expand Down

0 comments on commit 1609940

Please sign in to comment.