automated terminal push
This commit is contained in:
@@ -68,7 +68,7 @@ resource "aws_subnet" "private" {
|
|||||||
resource "aws_eip" "nat" {
|
resource "aws_eip" "nat" {
|
||||||
count = var.enable_private_subnets && var.enable_nat_gateway ? (var.single_nat_gateway ? 1 : 2) : 0
|
count = var.enable_private_subnets && var.enable_nat_gateway ? (var.single_nat_gateway ? 1 : 2) : 0
|
||||||
|
|
||||||
domain = "vpc"
|
domain = "vpc"
|
||||||
depends_on = [aws_internet_gateway.main]
|
depends_on = [aws_internet_gateway.main]
|
||||||
|
|
||||||
tags = {
|
tags = {
|
||||||
@@ -118,7 +118,7 @@ resource "aws_route_table" "private" {
|
|||||||
dynamic "route" {
|
dynamic "route" {
|
||||||
for_each = var.enable_nat_gateway ? [1] : []
|
for_each = var.enable_nat_gateway ? [1] : []
|
||||||
content {
|
content {
|
||||||
cidr_block = "0.0.0.0/0"
|
cidr_block = "0.0.0.0/0"
|
||||||
# If single NAT gateway, all route tables use index 0, otherwise use the route table's index
|
# If single NAT gateway, all route tables use index 0, otherwise use the route table's index
|
||||||
nat_gateway_id = aws_nat_gateway.main[var.single_nat_gateway ? 0 : count.index].id
|
nat_gateway_id = aws_nat_gateway.main[var.single_nat_gateway ? 0 : count.index].id
|
||||||
}
|
}
|
||||||
@@ -314,9 +314,9 @@ resource "aws_s3_bucket_public_access_block" "terraform_state" {
|
|||||||
|
|
||||||
# DynamoDB Table for Terraform State Locking
|
# DynamoDB Table for Terraform State Locking
|
||||||
resource "aws_dynamodb_table" "terraform_locks" {
|
resource "aws_dynamodb_table" "terraform_locks" {
|
||||||
name = "${var.project_name}-terraform-locks"
|
name = "${var.project_name}-terraform-locks"
|
||||||
billing_mode = "PAY_PER_REQUEST"
|
billing_mode = "PAY_PER_REQUEST"
|
||||||
hash_key = "LockID"
|
hash_key = "LockID"
|
||||||
|
|
||||||
attribute {
|
attribute {
|
||||||
name = "LockID"
|
name = "LockID"
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ output "ecs_tasks_security_group_id" {
|
|||||||
|
|
||||||
output "vpc_endpoints_security_group_id" {
|
output "vpc_endpoints_security_group_id" {
|
||||||
description = "ID of the VPC endpoints security group"
|
description = "ID of the VPC endpoints security group"
|
||||||
value = null # Not created in free tier version to avoid costs
|
value = null # Not created in free tier version to avoid costs
|
||||||
}
|
}
|
||||||
|
|
||||||
# Route Table Information
|
# Route Table Information
|
||||||
@@ -106,17 +106,17 @@ output "s3_vpc_endpoint_id" {
|
|||||||
|
|
||||||
output "ecr_dkr_vpc_endpoint_id" {
|
output "ecr_dkr_vpc_endpoint_id" {
|
||||||
description = "ID of the ECR Docker VPC endpoint"
|
description = "ID of the ECR Docker VPC endpoint"
|
||||||
value = null # Disabled in free tier version
|
value = null # Disabled in free tier version
|
||||||
}
|
}
|
||||||
|
|
||||||
output "ecr_api_vpc_endpoint_id" {
|
output "ecr_api_vpc_endpoint_id" {
|
||||||
description = "ID of the ECR API VPC endpoint"
|
description = "ID of the ECR API VPC endpoint"
|
||||||
value = null # Disabled in free tier version
|
value = null # Disabled in free tier version
|
||||||
}
|
}
|
||||||
|
|
||||||
output "logs_vpc_endpoint_id" {
|
output "logs_vpc_endpoint_id" {
|
||||||
description = "ID of the CloudWatch Logs VPC endpoint"
|
description = "ID of the CloudWatch Logs VPC endpoint"
|
||||||
value = null # Disabled in free tier version
|
value = null # Disabled in free tier version
|
||||||
}
|
}
|
||||||
|
|
||||||
# Terraform Backend Information
|
# Terraform Backend Information
|
||||||
|
|||||||
@@ -40,25 +40,25 @@ variable "enable_dns_support" {
|
|||||||
variable "enable_nat_gateway" {
|
variable "enable_nat_gateway" {
|
||||||
description = "Enable NAT gateways for private subnets (only relevant if private subnets enabled)"
|
description = "Enable NAT gateways for private subnets (only relevant if private subnets enabled)"
|
||||||
type = bool
|
type = bool
|
||||||
default = false # Default false for free tier
|
default = false # Default false for free tier
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "single_nat_gateway" {
|
variable "single_nat_gateway" {
|
||||||
description = "Use a single NAT gateway instead of one per AZ (cost optimization)"
|
description = "Use a single NAT gateway instead of one per AZ (cost optimization)"
|
||||||
type = bool
|
type = bool
|
||||||
default = true # Default true for cost optimization when NAT is enabled
|
default = true # Default true for cost optimization when NAT is enabled
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "enable_private_subnets" {
|
variable "enable_private_subnets" {
|
||||||
description = "Enable private subnets (requires NAT Gateway for internet access)"
|
description = "Enable private subnets (requires NAT Gateway for internet access)"
|
||||||
type = bool
|
type = bool
|
||||||
default = false # Set to false for free tier to avoid NAT Gateway costs
|
default = false # Set to false for free tier to avoid NAT Gateway costs
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "enable_vpc_endpoints" {
|
variable "enable_vpc_endpoints" {
|
||||||
description = "Enable VPC endpoints for AWS services (costs extra)"
|
description = "Enable VPC endpoints for AWS services (costs extra)"
|
||||||
type = bool
|
type = bool
|
||||||
default = false # Set to false for free tier to avoid interface endpoint costs
|
default = false # Set to false for free tier to avoid interface endpoint costs
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "cost_optimization_mode" {
|
variable "cost_optimization_mode" {
|
||||||
@@ -71,9 +71,9 @@ variable "common_tags" {
|
|||||||
description = "Common tags to apply to all resources"
|
description = "Common tags to apply to all resources"
|
||||||
type = map(string)
|
type = map(string)
|
||||||
default = {
|
default = {
|
||||||
Terraform = "true"
|
Terraform = "true"
|
||||||
Project = "enterprise-cicd"
|
Project = "enterprise-cicd"
|
||||||
Owner = "devops-team"
|
Owner = "devops-team"
|
||||||
CostCenter = "engineering"
|
CostCenter = "engineering"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user