Skip to content

Commit

Permalink
T3 - Updated Output Files
Browse files Browse the repository at this point in the history
  • Loading branch information
felipefreitassilva committed Dec 3, 2024
1 parent deab8ac commit e9948bb
Showing 1 changed file with 269 additions and 21 deletions.
290 changes: 269 additions & 21 deletions infra/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,44 +1,141 @@
output "private_key" {
value = tls_private_key.my_key.private_key_pem
sensitive = true
################################################################
############## ALB Outputs ############
################################################################

output "alb_arn" {
description = "ARN of the ALB"
value = module.alb.arn
}

output "alb_dns_name" {
description = "DNS name of the ALB"
value = module.alb.dns_name
}

output "alb_zone_id" {
description = "Hosted zone ID of the ALB"
value = module.alb.zone_id
}

output "alb_security_group_id" {
description = "Security group ID associated with the ALB"
value = aws_security_group.security_group.id
}

output "alb_http_listener_arn" {
description = "ARN of the HTTP listener for the ALB"
value = module.alb.listeners["http"].arn
}

output "alb_http_listener_port" {
description = "Port of the HTTP listener for the ALB"
value = module.alb.listeners["http"].port
}

output "alb_target_group_arn" {
description = "ARN of the ECS target group"
value = module.alb.target_groups["ecs"].arn
}

output "alb_target_group_deregistration_delay" {
description = "Deregistration delay configured for the ALB target group"
value = module.alb.target_groups["ecs"].deregistration_delay
}

################################################################
############## Backend Outputs ############
################################################################

output "terraform_backend_workspace" {
description = "The workspace name for the remote backend"
value = terraform.workspace
}

################################################################
############## Data Outputs ############
################################################################

output "available_availability_zones" {
description = "List of available availability zones"
value = data.aws_availability_zones.available.names
}

output "caller_identity_arn" {
description = "ARN of the current AWS caller"
value = data.aws_caller_identity.current.arn
}

output "public_key" {
value = tls_private_key.my_key.public_key_openssh
output "caller_identity_user_id" {
description = "User ID of the current AWS caller"
value = data.aws_caller_identity.current.user_id
}

output "caller_identity_account_id" {
description = "Account ID of the current AWS caller"
value = data.aws_caller_identity.current.account_id
}

################################################################
############## EC2 Outputs ############
################################################################

output "ec2_instance_id" {
description = "The ID of the EC2 instance"
value = aws_instance.ec2.id
}

output "ec2_public_ip" {
value = aws_instance.ec2.public_ip
description = "The public IP address of the EC2 instance"
value = aws_instance.ec2.public_ip
}

output "load_balancer_dns" {
description = "ALB DNS name"
value = module.alb.dns_name
output "ec2_private_ip" {
description = "The private IP address of the EC2 instance"
value = aws_instance.ec2.private_ip
}

output "vpc_id" {
value = module.vpc.vpc_id
output "ec2_instance_type" {
description = "The type of EC2 instance"
value = aws_instance.ec2.instance_type
}

output "vpc_cidr_block" {
value = module.vpc.vpc_cidr_block
output "ec2_ami" {
description = "The AMI ID used to launch the EC2 instance"
value = aws_instance.ec2.ami
}

output "availability_zones" {
value = module.vpc.azs
output "ec2_security_group_id" {
description = "Security group ID associated with the EC2 instance"
value = aws_instance.ec2.vpc_security_group_ids
}

output "public_subnets" {
value = module.vpc.public_subnets
output "ec2_key_name" {
description = "Key name associated with the EC2 instance"
value = aws_instance.ec2.key_name
}

output "private_subnets" {
value = module.vpc.private_subnets
output "ec2_user_data" {
description = "User data script used for the EC2 instance"
value = aws_instance.ec2.user_data
}

output "database_subnets" {
value = module.vpc.database_subnets
################################################################
############## ECR Outputs ############
################################################################

output "ecr_repository_url" {
description = "The URL of the ECR repository"
value = aws_ecr_repository.ecr.repository_url
}

output "ecr_repository_arn" {
description = "The ARN of the ECR repository"
value = aws_ecr_repository.ecr.arn
}

output "ecr_repository_name" {
description = "The name of the ECR repository"
value = aws_ecr_repository.ecr.name
}

################################################################
Expand Down Expand Up @@ -99,3 +196,154 @@ output "ecs_cluster_arn" {
description = "ARN of the ECS Cluster"
value = aws_ecs_cluster.ecs_cluster.arn
}

################################################################
############## Keys Outputs ############
################################################################

output "private_key_pem" {
description = "The private key in PEM format"
value = local_file.private_key_pem.content
sensitive = true
}

output "public_key_openssh" {
description = "The public key in OpenSSH format"
value = tls_private_key.my_key.public_key_openssh
}

output "key_pair_name" {
description = "The name of the AWS key pair"
value = aws_key_pair.my_key_pair.key_name
}

output "key_pair_fingerprint" {
description = "The fingerprint of the AWS key pair"
value = aws_key_pair.my_key_pair.fingerprint
}

################################################################
############## Locals Outputs ############
################################################################

output "name" {
description = "The full name of the project, combining environment and project name"
value = local.name
}

output "container_name" {
description = "The name of the container (ECR)"
value = local.container_name
}

output "container_port" {
description = "The port the container listens on"
value = local.container_port
}

output "user_id" {
description = "The AWS account ID of the current user"
value = local.user_id
}

output "tags" {
description = "The tags used for resources"
value = local.tags
}

################################################################
############## Security Groups Outputs ############
################################################################

output "security_group_id" {
description = "The ID of the security group"
value = aws_security_group.security_group.id
}

output "security_group_name" {
description = "The name of the security group"
value = aws_security_group.security_group.name
}

output "security_group_description" {
description = "The description of the security group"
value = aws_security_group.security_group.description
}

output "security_group_ingress_rules" {
description = "The ingress rules of the security group"
value = [
for rule in aws_security_group.security_group.ingress : {
description = rule.description
from_port = rule.from_port
to_port = rule.to_port
protocol = rule.protocol
cidr_blocks = rule.cidr_blocks
}
]
}

output "security_group_egress_rules" {
description = "The egress rules of the security group"
value = [
for rule in aws_security_group.security_group.egress : {
from_port = rule.from_port
to_port = rule.to_port
protocol = rule.protocol
cidr_blocks = rule.cidr_blocks
}
]
}

################################################################
############## Variables Outputs ############
################################################################

output "region" {
description = "AWS region to deploy to"
value = var.region
}

output "environment" {
description = "Environment to deploy to"
value = var.environment
}

output "project_name" {
description = "Name of the project"
value = var.project_name
}

################################################################
############## Versions Outputs ############
################################################################

output "vpc_id" {
description = "The ID of the VPC"
value = module.vpc.vpc_id
}

output "vpc_cidr_block" {
description = "The CIDR block of the VPC"
value = module.vpc.vpc_cidr_block
}

output "public_subnets" {
description = "The IDs of the public subnets"
value = module.vpc.public_subnets
}

output "private_subnets" {
description = "The IDs of the private subnets"
value = module.vpc.private_subnets
}

output "database_subnets" {
description = "The IDs of the database subnets"
value = module.vpc.database_subnets
}

output "availability_zones" {
description = "The availability zones where subnets are created"
value = module.vpc.azs
}

0 comments on commit e9948bb

Please sign in to comment.