Skip to content

Commit

Permalink
remove unused variables and fix create condtion on resources
Browse files Browse the repository at this point in the history
  • Loading branch information
h1manshu98 committed Jan 30, 2024
1 parent c388305 commit 4b6889d
Show file tree
Hide file tree
Showing 6 changed files with 129 additions and 251 deletions.
13 changes: 7 additions & 6 deletions _examples/complete/http-api-gateway/example.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ provider "aws" {
####----------------------------------------------------------------------------------

locals {
name = "api"
environment = "test"
domain_name = "clouddrove.ca"
region = "us-east-1"
name = "api"
environment = "test"
region = "us-east-1"
domain_name = "clouddrove.ca"
hosted_zone_id = "Z015XXXXXXXXXXXXXXIEP"
}
####----------------------------------------------------------------------------------
## ACM
Expand Down Expand Up @@ -78,10 +79,10 @@ module "api_gateway" {

name = local.name
environment = local.environment
domain_name = "clouddrove.ca"
domain_name = "api.${local.domain_name}"
domain_name_certificate_arn = module.acm.arn
integration_uri = module.lambda.invoke_arn
zone_id = "Z082xxxxxxxxxxx"
zone_id = local.hosted_zone_id
auto_deploy = true
stage_name = "$default"
create_vpc_link_enabled = false
Expand Down
40 changes: 19 additions & 21 deletions _examples/complete/private-rest-api-gateway/example.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ provider "aws" {
####----------------------------------------------------------------------------------

locals {
name = "api"
environment = "test"
domain_name = "clouddrove.ca"
region = "us-east-1"
name = "api"
environment = "test"
region = "us-east-1"
domain_name = "clouddrove.ca"
hosted_zone_id = "Z015XXXXXXXXXXXXXXIEP"
}
####----------------------------------------------------------------------------------
## ACM
Expand Down Expand Up @@ -114,7 +115,7 @@ module "subnets" {
rule_action = "allow"
from_port = 0
to_port = 0
protocol = "tcp"
protocol = "-1"
cidr_block = module.vpc.vpc_cidr_block
}
]
Expand All @@ -124,28 +125,28 @@ module "subnets" {
rule_action = "allow"
from_port = 0
to_port = 0
protocol = "tcp"
protocol = "-1"
cidr_block = module.vpc.vpc_cidr_block
}
]
public_outbound_acl_rules = [
public_inbound_acl_rules = [
{
rule_number = 100
rule_action = "allow"
from_port = 0
to_port = 0
protocol = "tcp"
cidr_block = module.vpc.vpc_cidr_block
protocol = "-1"
cidr_block = "0.0.0.0/0"
}
]
public_inbound_acl_rules = [
public_outbound_acl_rules = [
{
rule_number = 100
rule_action = "allow"
from_port = 0
to_port = 0
protocol = "tcp"
cidr_block = module.vpc.vpc_cidr_block
protocol = "-1"
cidr_block = "0.0.0.0/0"
}
]

Expand Down Expand Up @@ -200,25 +201,22 @@ module "rest_api_private" {
rest_api_endpoint_type = "PRIVATE"
rest_api_description = "Private REST API for ${module.lambda.name} lambda function"
integration_uri = module.lambda.invoke_arn
rest_api_stage_name = "tests"
rest_api_stage_name = "default"
auto_deploy = true
rest_api_base_path = "test"
# -- Required
domain_name = local.domain_name
zone_id = "Z0156xxxxxxxxxxxxxx"
domain_name = "api.${local.domain_name}"
zone_id = local.hosted_zone_id

# -- VPC Endpoint configuration
vpc_id = module.vpc.vpc_id
service_name = "com.amazonaws.us-east-1.execute-api"
vpc_endpoint_type = "Interface"
private_dns_enabled = true
subnet_ids = module.subnets.private_subnet_id
security_group_ids = [module.security_group.security_group_id]
service_name = "com.amazonaws.${local.region}.execute-api"
vpc_endpoint_type = "Interface"
private_dns_enabled = true
domain_name_certificate_arn = module.acm.arn


#---access log----

enable_access_logs = true
retention_in_days = 7
}
Expand Down
34 changes: 8 additions & 26 deletions _examples/complete/rest-api-gateway/example.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ provider "aws" {
####----------------------------------------------------------------------------------

locals {
name = "api"
environment = "test"
domain_name = "clouddrove.ca"
region = "us-east-1"
name = "api"
environment = "test"
region = "us-east-1"
domain_name = "clouddrove.ca"
hosted_zone_id = "Z015XXXXXXXXXXXXXXIEP"
}
####----------------------------------------------------------------------------------
## ACM
Expand Down Expand Up @@ -80,8 +81,10 @@ module "rest_api" {

name = "${local.name}-rest-api"
environment = local.environment
domain_name_certificate_arn = module.acm.arn
create_rest_api = true
domain_name_certificate_arn = module.acm.arn
domain_name = "api.${local.domain_name}"
zone_id = local.hosted_zone_id
rest_api_description = "REST API for ${module.lambda.name} lambda function"
rest_api_endpoint_type = "REGIONAL"
integration_uri = module.lambda.invoke_arn
Expand All @@ -101,29 +104,8 @@ module "rest_api" {
}

#---access log----

enable_access_logs = true
retention_in_days = 7


# -- Required
domain_name = local.domain_name
zone_id = "Z015646xxxxxxxxxxx"
rest_api_role = <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Action": "sts:AssumeRole",
"Principal": {
"Service": "apigateway.amazonaws.com"
},
"Effect": "Allow",
"Sid": ""
}
]
}
EOF
}


Expand Down
Loading

0 comments on commit 4b6889d

Please sign in to comment.