This file contains 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
name: Docker Nginx ECS Build, Test, & Log Creation | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
create-ecs-repo: | |
runs-on: ubuntu-latest |
This file contains 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
# --- variables.tf --- | |
variable "private_cidrs" { | |
type = string | |
default = "10.0.1.0/24" | |
} | |
variable "public_cidrs" { | |
type = string | |
default = "10.0.101.0/24" |
This file contains 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
# This file is a template, and might need editing before it works on your project. | |
# To contribute improvements to CI/CD templates, please follow the Development guide at: | |
# https://docs.gitlab.com/ee/development/cicd/templates.html | |
# This specific template is located at: | |
# https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Terraform.gitlab-ci.yml | |
image: | |
name: hashicorp/terraform:light | |
entrypoint: [""] | |
This file contains 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
# --- ecs.tf --- | |
resource "aws_ecs_cluster" "new_ecs_cluster" { | |
name = "katorias-cluster" | |
} | |
resource "aws_ecs_task_definition" "new-task" { | |
family = "service" | |
network_mode = "awsvpc" | |
requires_compatibilities = ["FARGATE"] |
This file contains 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_lb" "tfcloud_lb" { | |
name = "tfcloud-alb" | |
internal = false | |
load_balancer_type = "application" | |
security_groups = [var.web_sg] | |
subnets = tolist(var.public_subnet) | |
depends_on = [ | |
var.database_asg | |
] |
This file contains 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
data "aws_rds_engine_version" "test" { | |
engine = "mysql" | |
preferred_versions = ["8.0.27"] | |
} | |
data "aws_ami" "linux" { | |
most_recent = true | |
filter { | |
name = "name" |
This file contains 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/main.tf --- | |
#Instance Module | |
module "Compute" { | |
source = "./Modules/Compute" | |
elb = module.LoadBalancer.elb | |
alb_tg = module.LoadBalancer.alb_tg | |
private_subnet = module.Networking.private_subnet | |
public_subnet = module.Networking.public_subnet | |
public_sg = module.Networking.public_sg |
This file contains 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/main.tf --- | |
#Sample Instance Module | |
module "ec2_instance" { | |
source = "./Modules/Compute" | |
} | |
#Sample Security Group Module | |
module "vpc_sg" { | |
source = "./Modules/Security" |
This file contains 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_security_group" "allow_http" { | |
name = "allow_http" | |
description = "Allow http inbound traffic" | |
vpc_id = "vpc-046434f94c971bec4" | |
ingress { | |
from_port = "443" | |
to_port = "443" | |
protocol = "tcp" | |
cidr_blocks = ["0.0.0.0/0"] |
This file contains 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
provider "aws" { | |
region = var.region | |
} | |
resource "aws_vpc" "modulevpc" { | |
cidr_block = "10.0.0.0/16" | |
} | |
resource "aws_internet_gateway" "IGW" { | |
vpc_id = aws_vpc.modulevpc.id |
NewerOlder