This file contains hidden or 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
| # Local .terraform directories | |
| **/.terraform/* | |
| # .tfstate files | |
| *.tfstate | |
| *.tfstate.* | |
| # Crash log files | |
| crash.log |
This file contains hidden or 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
| ###---root(terraformec2)/outputs.tf--- | |
| output "public_ip_addr" { | |
| value = module.ec2-instance.public_ip_addr | |
| } | |
| output "ec2_name" { | |
| value = module.ec2-instance.ec2_name | |
| } |
This file contains hidden or 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
| ###---/ec2/outputs.tf--- | |
| output "ec2_name" { | |
| value = aws_instance.app_server[*].tags_all.Name | |
| } | |
| output "public_ip_addr" { | |
| value = aws_instance.app_server[*].public_ip | |
| } |
This file contains hidden or 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
| ###---root(terraformec2)/ec2.tf--- | |
| module "ec2-instance" { #calls the ec2-instance module | |
| source = "./ec2" #file path to files in /ec2 | |
| } |
This file contains hidden or 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
| ###---/terraformec2/ec2/variables.tf--- | |
| variable "ami_id" { | |
| type = string | |
| default = "ami-0cea098ed2ac54925" # ami id | |
| } | |
| variable "ec2_instance_type" { | |
| type = string | |
| default = "t2.micro" # free tier instance type |
This file contains hidden or 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
| ###---/terraformec2/ec2/providers.tf--- | |
| terraform { | |
| required_providers { | |
| aws = { | |
| source = "hashicorp/aws" | |
| version = "~> 3.27" | |
| } | |
| } |
This file contains hidden or 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
| ###---/terraformec2/ec2/main.tf--- | |
| resource "aws_instance" "app_server" { | |
| ami = var.ami_id | |
| instance_type = var.ec2_instance_type | |
| tags = { | |
| Name = "ExampleAppServerInstance" | |
| } | |
| } |
This file contains hidden or 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
| terraform { | |
| required_providers { | |
| aws = { | |
| source = "hashicorp/aws" | |
| version = "~> 3.27" | |
| } | |
| } | |
| required_version = ">= 0.14.9" | |
| } |
This file contains hidden or 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
| resource "aws_ecs_cluster" "ecs-cluster" { | |
| name = "ecs-cluster-project" | |
| } | |
| resource "aws_ecs_cluster_capacity_providers" "ecs-cap-provider" { | |
| cluster_name = aws_ecs_cluster.ecs-cluster.id | |
| capacity_providers = ["FARGATE"] | |
| default_capacity_provider_strategy { | |
| base = 1 |
This file contains hidden or 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
| resource "aws_subnet" "private_ecs_subnet1" { | |
| vpc_id = aws_vpc.ecs_tf_vpc.id | |
| cidr_block = "10.0.1.0/24" | |
| availability_zone = "us-east-1a" | |
| map_public_ip_on_launch = false | |
| tags = { | |
| "Name" = "private_ecs_subnet1" | |
| } | |
| } |
NewerOlder