From 2784dd857e456461564e024c8dcac49decded0f0 Mon Sep 17 00:00:00 2001 From: EC2 Default User Date: Sat, 28 Sep 2024 21:31:29 +0000 Subject: [PATCH 01/23] terraform folder added --- terraform/main.tf | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 terraform/main.tf diff --git a/terraform/main.tf b/terraform/main.tf new file mode 100644 index 0000000..e69de29 From b7f8f5580b4660118bf1ed8bdd3c1957f8def38a Mon Sep 17 00:00:00 2001 From: Krishna Khatiwada Date: Sat, 28 Sep 2024 21:34:25 +0000 Subject: [PATCH 02/23] terraform code added --- terraform/dev/instances/assignment1-dev | 39 ++++ terraform/dev/instances/assignment1-dev.pub | 1 + .../{main.tf => dev/instances/config.tf} | 0 terraform/dev/instances/main.tf | 171 ++++++++++++++++++ terraform/dev/instances/output.tf | 12 ++ terraform/dev/instances/variables.tf | 22 +++ terraform/modules/globalvars/output.tf | 13 ++ 7 files changed, 258 insertions(+) create mode 100644 terraform/dev/instances/assignment1-dev create mode 100644 terraform/dev/instances/assignment1-dev.pub rename terraform/{main.tf => dev/instances/config.tf} (100%) create mode 100644 terraform/dev/instances/main.tf create mode 100644 terraform/dev/instances/output.tf create mode 100644 terraform/dev/instances/variables.tf create mode 100644 terraform/modules/globalvars/output.tf diff --git a/terraform/dev/instances/assignment1-dev b/terraform/dev/instances/assignment1-dev new file mode 100644 index 0000000..ad84e8b --- /dev/null +++ b/terraform/dev/instances/assignment1-dev @@ -0,0 +1,39 @@ +-----BEGIN OPENSSH PRIVATE KEY----- +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 +AgMEBQ== +-----END OPENSSH PRIVATE KEY----- diff --git a/terraform/dev/instances/assignment1-dev.pub b/terraform/dev/instances/assignment1-dev.pub new file mode 100644 index 0000000..611942b --- /dev/null +++ b/terraform/dev/instances/assignment1-dev.pub @@ -0,0 +1 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC2PfN+vH4wS5qc8YEeXPhE2bMwssiO8EBHXd52KoZTVdbuzbkO8/8Nwf7B3sKpB9NyYjJtgmxO6KYa/qp29MmlC35iOxw/nqzCUcikUqE64DZTyT0yTTVK95lH8j6ohwP+2KcJtOlSgwjDmb+noYC7BrYOEzodqzkjlqYSVSetUzAv1YMg7SAn6AQ7xGXyIwkfUHkGMjEBxSdVvecDv6/RAD0NF2mn+OgM074oXi6vMrwe+tGNMaeOfmuTZqgaKqq1NGX1UZa2BlV2W3eRc0k65TcPbymo5jGfDMe0oSYAokG80mQJ13SKJ12ZdItv1THm3X63xWXfhiGU9xdQ1IgSYG2/X5z8+92GXja0OPrYPm9gFE6XgvCaFgG+fKJt3gM9iGNx8daFBaJMD524NFiSwTfbi9E4UrE/CRr2W4AsDGOasM13z570s9nZvFuSfv8tFNsxlKco0/9K7W2lf63u6g3EKfeIaJkYUMhIGN/s7m6+516LiYz2Vf5gknTeems= ec2-user@ip-172-31-89-201.ec2.internal diff --git a/terraform/main.tf b/terraform/dev/instances/config.tf similarity index 100% rename from terraform/main.tf rename to terraform/dev/instances/config.tf diff --git a/terraform/dev/instances/main.tf b/terraform/dev/instances/main.tf new file mode 100644 index 0000000..320c8be --- /dev/null +++ b/terraform/dev/instances/main.tf @@ -0,0 +1,171 @@ +#---------------------------------------------------------- +# ACS730 - Week 3 - Terraform Introduction +# +# Build EC2 Instances and Create ECR Repository +# +#---------------------------------------------------------- + +# Define the provider +provider "aws" { + region = "us-east-1" +} + +# Data source for AMI id +data "aws_ami" "latest_amazon_linux" { + owners = ["amazon"] + most_recent = true + filter { + name = "name" + values = ["amzn2-ami-hvm-*-x86_64-gp2"] + } +} + +# Data source for availability zones in us-east-1 +data "aws_availability_zones" "available" { + state = "available" +} + +# Data block to retrieve the default VPC id +data "aws_vpc" "default" { + default = true +} + +# Define tags locally +locals { + default_tags = merge(module.globalvars.default_tags, { "env" = var.env }) + prefix = module.globalvars.prefix + name_prefix = "${local.prefix}-${var.env}" +} + +# Retrieve global variables from the Terraform module +module "globalvars" { + source = "../../modules/globalvars" +} + +# Reference subnet provisioned by 01-Networking +resource "aws_instance" "my_instance" { + ami = data.aws_ami.latest_amazon_linux.id + instance_type = lookup(var.instance_type, var.env) + key_name = aws_key_pair.my_key.key_name + vpc_security_group_ids = [aws_security_group.my_sg.id] + associate_public_ip_address = false + + lifecycle { + create_before_destroy = true + } + + tags = merge(local.default_tags, + { + "Name" = "${local.name_prefix}-my-instance-Linux" + } + ) +} + +# Create two more instances +resource "aws_instance" "my_instance_1" { + ami = data.aws_ami.latest_amazon_linux.id + instance_type = lookup(var.instance_type, var.env) + key_name = aws_key_pair.my_key.key_name + vpc_security_group_ids = [aws_security_group.my_sg.id] + associate_public_ip_address = false + + lifecycle { + create_before_destroy = true + } + + tags = merge(local.default_tags, + { + "Name" = "${local.name_prefix}-my-instance-1" + } + ) +} + +resource "aws_instance" "my_instance_2" { + ami = data.aws_ami.latest_amazon_linux.id + instance_type = lookup(var.instance_type, var.env) + key_name = aws_key_pair.my_key.key_name + vpc_security_group_ids = [aws_security_group.my_sg.id] + associate_public_ip_address = false + + lifecycle { + create_before_destroy = true + } + + tags = merge(local.default_tags, + { + "Name" = "${local.name_prefix}-my-instance-2" + } + ) +} + +# Adding SSH key to Amazon EC2 +resource "aws_key_pair" "my_key" { + key_name = local.name_prefix + public_key = file("${local.name_prefix}.pub") +} + +# Security Group +resource "aws_security_group" "my_sg" { + name = "allow_ssh" + description = "Allow SSH inbound traffic" + vpc_id = data.aws_vpc.default.id + + ingress { + description = "SSH from everywhere" + from_port = 22 + to_port = 22 + protocol = "tcp" + cidr_blocks = ["0.0.0.0/0"] + ipv6_cidr_blocks = ["::/0"] + } + + egress { + from_port = 0 + to_port = 0 + protocol = "-1" + cidr_blocks = ["0.0.0.0/0"] + ipv6_cidr_blocks = ["::/0"] + } + + tags = merge(local.default_tags, + { + "Name" = "${local.name_prefix}-sg" + } + ) +} + +# Elastic IP +resource "aws_eip" "static_eip_my_instance" { + instance = aws_instance.my_instance.id + tags = merge(local.default_tags, + { + "Name" = "${local.name_prefix}-eip" + } + ) +} +resource "aws_eip" "static_eip_my_instance_1" { + instance = aws_instance.my_instance_1.id + tags = merge(local.default_tags, + { + "Name" = "${local.name_prefix}-eip" + } + ) +} +resource "aws_eip" "static_eip_my_instance_2" { + instance = aws_instance.my_instance_2.id + tags = merge(local.default_tags, + { + "Name" = "${local.name_prefix}-eip" + } + ) +} +# Elastic Container Registry (ECR) - Create a new repository +resource "aws_ecr_repository" "my_ecr_repo" { + name = lower("${local.name_prefix}-ecr-repo") + image_tag_mutability = "MUTABLE" + tags = merge(local.default_tags, + { + "Name" = "${local.name_prefix}-ecr-repo" + } + ) +} diff --git a/terraform/dev/instances/output.tf b/terraform/dev/instances/output.tf new file mode 100644 index 0000000..ffea506 --- /dev/null +++ b/terraform/dev/instances/output.tf @@ -0,0 +1,12 @@ +# Step 10 - Add output variables +output "eip_my_instance" { + value = aws_eip.static_eip_my_instance.public_ip +} + +output "eip_my_instance1" { + value = aws_eip.static_eip_my_instance_1.public_ip +} + +output "eip_my_instance2" { + value = aws_eip.static_eip_my_instance_2.public_ip +} \ No newline at end of file diff --git a/terraform/dev/instances/variables.tf b/terraform/dev/instances/variables.tf new file mode 100644 index 0000000..f25e07a --- /dev/null +++ b/terraform/dev/instances/variables.tf @@ -0,0 +1,22 @@ +# Instance type +variable "instance_type" { + default = { + "prod" = "t3.medium" + "test" = "t3.micro" + "staging" = "t2.micro" + "dev" = "t2.micro" + } + description = "Type of the instance" + type = map(string) +} + +# Variable to signal the current environment +variable "env" { + default = "dev" + type = string + description = "Deployment Environment" +} + + + + diff --git a/terraform/modules/globalvars/output.tf b/terraform/modules/globalvars/output.tf new file mode 100644 index 0000000..5f23812 --- /dev/null +++ b/terraform/modules/globalvars/output.tf @@ -0,0 +1,13 @@ +# Default tags +output "default_tags" { + value = { + "Owner" = "DockerAssignment" + "App" = "Web" + "Project" = "assignment" + } +} + +# Prefix to identify resources +output "prefix" { + value = "assignment1" +} \ No newline at end of file From 6b071aec113665faab7b872d239b7ee911a1bf2b Mon Sep 17 00:00:00 2001 From: Krishna Khatiwada Date: Sat, 28 Sep 2024 21:47:45 +0000 Subject: [PATCH 03/23] running terraform code --- terraform/dev/instances/.gitignore | 12 + terraform/dev/instances/assignment1-dev | 39 - terraform/dev/instances/assignment1-dev.pub | 1 - terraform/dev/instances/terraform.tfstate | 947 ++++++++++++++++++ .../dev/instances/terraform.tfstate.backup | 243 +++++ 5 files changed, 1202 insertions(+), 40 deletions(-) create mode 100644 terraform/dev/instances/.gitignore delete mode 100644 terraform/dev/instances/assignment1-dev delete mode 100644 terraform/dev/instances/assignment1-dev.pub create mode 100644 terraform/dev/instances/terraform.tfstate create mode 100644 terraform/dev/instances/terraform.tfstate.backup diff --git a/terraform/dev/instances/.gitignore b/terraform/dev/instances/.gitignore new file mode 100644 index 0000000..c189efd --- /dev/null +++ b/terraform/dev/instances/.gitignore @@ -0,0 +1,12 @@ +# Ignore Terraform state and backup files +.terraform + +# Ignore Terraform cache and provider files +.terraform/ + +# Optionally ignore the lock file +.terraform.lock.hcl + +# Exclude SSH keys (if sensitive) +assignmentdocker-dev +assignmentdocker-dev.pub \ No newline at end of file diff --git a/terraform/dev/instances/assignment1-dev b/terraform/dev/instances/assignment1-dev deleted file mode 100644 index ad84e8b..0000000 --- a/terraform/dev/instances/assignment1-dev +++ /dev/null @@ -1,39 +0,0 @@ ------BEGIN OPENSSH PRIVATE KEY----- -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 -AgMEBQ== ------END OPENSSH PRIVATE KEY----- diff --git a/terraform/dev/instances/assignment1-dev.pub b/terraform/dev/instances/assignment1-dev.pub deleted file mode 100644 index 611942b..0000000 --- a/terraform/dev/instances/assignment1-dev.pub +++ /dev/null @@ -1 +0,0 @@ -ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC2PfN+vH4wS5qc8YEeXPhE2bMwssiO8EBHXd52KoZTVdbuzbkO8/8Nwf7B3sKpB9NyYjJtgmxO6KYa/qp29MmlC35iOxw/nqzCUcikUqE64DZTyT0yTTVK95lH8j6ohwP+2KcJtOlSgwjDmb+noYC7BrYOEzodqzkjlqYSVSetUzAv1YMg7SAn6AQ7xGXyIwkfUHkGMjEBxSdVvecDv6/RAD0NF2mn+OgM074oXi6vMrwe+tGNMaeOfmuTZqgaKqq1NGX1UZa2BlV2W3eRc0k65TcPbymo5jGfDMe0oSYAokG80mQJ13SKJ12ZdItv1THm3X63xWXfhiGU9xdQ1IgSYG2/X5z8+92GXja0OPrYPm9gFE6XgvCaFgG+fKJt3gM9iGNx8daFBaJMD524NFiSwTfbi9E4UrE/CRr2W4AsDGOasM13z570s9nZvFuSfv8tFNsxlKco0/9K7W2lf63u6g3EKfeIaJkYUMhIGN/s7m6+516LiYz2Vf5gknTeems= ec2-user@ip-172-31-89-201.ec2.internal diff --git a/terraform/dev/instances/terraform.tfstate b/terraform/dev/instances/terraform.tfstate new file mode 100644 index 0000000..e76bcce --- /dev/null +++ b/terraform/dev/instances/terraform.tfstate @@ -0,0 +1,947 @@ +{ + "version": 4, + "terraform_version": "1.9.6", + "serial": 18, + "lineage": "ca5d1e0f-4e38-d0e9-f5fe-3091027f23b0", + "outputs": { + "eip_my_instance": { + "value": "52.55.167.209", + "type": "string" + }, + "eip_my_instance1": { + "value": "3.226.21.184", + "type": "string" + }, + "eip_my_instance2": { + "value": "98.82.226.52", + "type": "string" + } + }, + "resources": [ + { + "mode": "data", + "type": "aws_ami", + "name": "latest_amazon_linux", + "provider": "provider[\"registry.terraform.io/hashicorp/aws\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "architecture": "x86_64", + "arn": "arn:aws:ec2:us-east-1::image/ami-052b9fbb6949f883a", + "block_device_mappings": [ + { + "device_name": "/dev/xvda", + "ebs": { + "delete_on_termination": "true", + "encrypted": "false", + "iops": "0", + "snapshot_id": "snap-0be4171a54ec9da0b", + "throughput": "0", + "volume_size": "8", + "volume_type": "gp2" + }, + "no_device": "", + "virtual_name": "" + } + ], + "boot_mode": "", + "creation_date": "2024-09-16T18:59:41.000Z", + "deprecation_time": "2025-07-01T00:00:00.000Z", + "description": "Amazon Linux 2 AMI 2.0.20240916.0 x86_64 HVM gp2", + "ena_support": true, + "executable_users": null, + "filter": [ + { + "name": "name", + "values": [ + "amzn2-ami-hvm-*-x86_64-gp2" + ] + } + ], + "hypervisor": "xen", + "id": "ami-052b9fbb6949f883a", + "image_id": "ami-052b9fbb6949f883a", + "image_location": "amazon/amzn2-ami-hvm-2.0.20240916.0-x86_64-gp2", + "image_owner_alias": "amazon", + "image_type": "machine", + "imds_support": "", + "include_deprecated": false, + "kernel_id": "", + "most_recent": true, + "name": "amzn2-ami-hvm-2.0.20240916.0-x86_64-gp2", + "name_regex": null, + "owner_id": "137112412989", + "owners": [ + "amazon" + ], + "platform": "", + "platform_details": "Linux/UNIX", + "product_codes": [], + "public": true, + "ramdisk_id": "", + "root_device_name": "/dev/xvda", + "root_device_type": "ebs", + "root_snapshot_id": "snap-0be4171a54ec9da0b", + "sriov_net_support": "simple", + "state": "available", + "state_reason": { + "code": "UNSET", + "message": "UNSET" + }, + "tags": {}, + "timeouts": null, + "tpm_support": "", + "usage_operation": "RunInstances", + "virtualization_type": "hvm" + }, + "sensitive_attributes": [] + } + ] + }, + { + "mode": "data", + "type": "aws_availability_zones", + "name": "available", + "provider": "provider[\"registry.terraform.io/hashicorp/aws\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "all_availability_zones": null, + "exclude_names": null, + "exclude_zone_ids": null, + "filter": null, + "group_names": [ + "us-east-1" + ], + "id": "us-east-1", + "names": [ + "us-east-1a", + "us-east-1b", + "us-east-1c", + "us-east-1d", + "us-east-1e", + "us-east-1f" + ], + "state": "available", + "timeouts": null, + "zone_ids": [ + "use1-az1", + "use1-az2", + "use1-az4", + "use1-az6", + "use1-az3", + "use1-az5" + ] + }, + "sensitive_attributes": [] + } + ] + }, + { + "mode": "data", + "type": "aws_vpc", + "name": "default", + "provider": "provider[\"registry.terraform.io/hashicorp/aws\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "arn": "arn:aws:ec2:us-east-1:345771349539:vpc/vpc-0fe25bfc810e1d519", + "cidr_block": "172.31.0.0/16", + "cidr_block_associations": [ + { + "association_id": "vpc-cidr-assoc-0c06c0bce6df7ec24", + "cidr_block": "172.31.0.0/16", + "state": "associated" + } + ], + "default": true, + "dhcp_options_id": "dopt-0b6c688c87b2861c5", + "enable_dns_hostnames": true, + "enable_dns_support": true, + "enable_network_address_usage_metrics": false, + "filter": null, + "id": "vpc-0fe25bfc810e1d519", + "instance_tenancy": "default", + "ipv6_association_id": "", + "ipv6_cidr_block": "", + "main_route_table_id": "rtb-0395b3b999ce80ba7", + "owner_id": "345771349539", + "state": null, + "tags": {}, + "timeouts": null + }, + "sensitive_attributes": [] + } + ] + }, + { + "mode": "managed", + "type": "aws_ecr_repository", + "name": "my_ecr_repo", + "provider": "provider[\"registry.terraform.io/hashicorp/aws\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "arn": "arn:aws:ecr:us-east-1:345771349539:repository/assignmentdocker-dev-ecr-repo", + "encryption_configuration": [ + { + "encryption_type": "AES256", + "kms_key": "" + } + ], + "force_delete": null, + "id": "assignmentdocker-dev-ecr-repo", + "image_scanning_configuration": [ + { + "scan_on_push": false + } + ], + "image_tag_mutability": "MUTABLE", + "name": "assignmentdocker-dev-ecr-repo", + "registry_id": "345771349539", + "repository_url": "345771349539.dkr.ecr.us-east-1.amazonaws.com/assignmentdocker-dev-ecr-repo", + "tags": { + "App": "Web", + "Name": "assignmentdocker-dev-ecr-repo", + "Owner": "DockerAssignment", + "Project": "assignment", + "env": "dev" + }, + "tags_all": { + "App": "Web", + "Name": "assignmentdocker-dev-ecr-repo", + "Owner": "DockerAssignment", + "Project": "assignment", + "env": "dev" + }, + "timeouts": null + }, + "sensitive_attributes": [], + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiZGVsZXRlIjoxMjAwMDAwMDAwMDAwfX0=" + } + ] + }, + { + "mode": "managed", + "type": "aws_eip", + "name": "static_eip_my_instance", + "provider": "provider[\"registry.terraform.io/hashicorp/aws\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "address": null, + "allocation_id": "eipalloc-04870422c25df54d0", + "arn": "arn:aws:ec2:us-east-1:345771349539:elastic-ip/eipalloc-04870422c25df54d0", + "associate_with_private_ip": null, + "association_id": "eipassoc-03c694d927363814f", + "carrier_ip": "", + "customer_owned_ip": "", + "customer_owned_ipv4_pool": "", + "domain": "vpc", + "id": "eipalloc-04870422c25df54d0", + "instance": "i-08e6eb9f316248fb6", + "network_border_group": "us-east-1", + "network_interface": "eni-0d1a87fb44dbd5295", + "private_dns": "ip-172-31-93-39.ec2.internal", + "private_ip": "172.31.93.39", + "ptr_record": "", + "public_dns": "ec2-52-55-167-209.compute-1.amazonaws.com", + "public_ip": "52.55.167.209", + "public_ipv4_pool": "amazon", + "tags": { + "App": "Web", + "Name": "assignmentdocker-dev-eip", + "Owner": "DockerAssignment", + "Project": "assignment", + "env": "dev" + }, + "tags_all": { + "App": "Web", + "Name": "assignmentdocker-dev-eip", + "Owner": "DockerAssignment", + "Project": "assignment", + "env": "dev" + }, + "timeouts": null, + "vpc": true + }, + "sensitive_attributes": [], + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiZGVsZXRlIjoxODAwMDAwMDAwMDAsInJlYWQiOjkwMDAwMDAwMDAwMCwidXBkYXRlIjozMDAwMDAwMDAwMDB9fQ==", + "dependencies": [ + "aws_instance.my_instance", + "aws_key_pair.my_key", + "aws_security_group.my_sg", + "data.aws_ami.latest_amazon_linux", + "data.aws_vpc.default" + ] + } + ] + }, + { + "mode": "managed", + "type": "aws_eip", + "name": "static_eip_my_instance_1", + "provider": "provider[\"registry.terraform.io/hashicorp/aws\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "address": null, + "allocation_id": "eipalloc-0247c6ccc13ab9c2a", + "arn": "arn:aws:ec2:us-east-1:345771349539:elastic-ip/eipalloc-0247c6ccc13ab9c2a", + "associate_with_private_ip": null, + "association_id": "eipassoc-060efd4e02b834666", + "carrier_ip": "", + "customer_owned_ip": "", + "customer_owned_ipv4_pool": "", + "domain": "vpc", + "id": "eipalloc-0247c6ccc13ab9c2a", + "instance": "i-019ca8f09e4db89c8", + "network_border_group": "us-east-1", + "network_interface": "eni-0961d3d5a2cab1f25", + "private_dns": "ip-172-31-88-43.ec2.internal", + "private_ip": "172.31.88.43", + "ptr_record": "", + "public_dns": "ec2-3-226-21-184.compute-1.amazonaws.com", + "public_ip": "3.226.21.184", + "public_ipv4_pool": "amazon", + "tags": { + "App": "Web", + "Name": "assignmentdocker-dev-eip", + "Owner": "DockerAssignment", + "Project": "assignment", + "env": "dev" + }, + "tags_all": { + "App": "Web", + "Name": "assignmentdocker-dev-eip", + "Owner": "DockerAssignment", + "Project": "assignment", + "env": "dev" + }, + "timeouts": null, + "vpc": true + }, + "sensitive_attributes": [], + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiZGVsZXRlIjoxODAwMDAwMDAwMDAsInJlYWQiOjkwMDAwMDAwMDAwMCwidXBkYXRlIjozMDAwMDAwMDAwMDB9fQ==", + "dependencies": [ + "aws_instance.my_instance_1", + "aws_key_pair.my_key", + "aws_security_group.my_sg", + "data.aws_ami.latest_amazon_linux", + "data.aws_vpc.default" + ] + } + ] + }, + { + "mode": "managed", + "type": "aws_eip", + "name": "static_eip_my_instance_2", + "provider": "provider[\"registry.terraform.io/hashicorp/aws\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "address": null, + "allocation_id": "eipalloc-067a198e8fca138fa", + "arn": "arn:aws:ec2:us-east-1:345771349539:elastic-ip/eipalloc-067a198e8fca138fa", + "associate_with_private_ip": null, + "association_id": "eipassoc-0db0ff3d55e3b1dd3", + "carrier_ip": "", + "customer_owned_ip": "", + "customer_owned_ipv4_pool": "", + "domain": "vpc", + "id": "eipalloc-067a198e8fca138fa", + "instance": "i-0612ed9124246fb01", + "network_border_group": "us-east-1", + "network_interface": "eni-0be4318e5cb4eb111", + "private_dns": "ip-172-31-82-2.ec2.internal", + "private_ip": "172.31.82.2", + "ptr_record": "", + "public_dns": "ec2-98-82-226-52.compute-1.amazonaws.com", + "public_ip": "98.82.226.52", + "public_ipv4_pool": "amazon", + "tags": { + "App": "Web", + "Name": "assignmentdocker-dev-eip", + "Owner": "DockerAssignment", + "Project": "assignment", + "env": "dev" + }, + "tags_all": { + "App": "Web", + "Name": "assignmentdocker-dev-eip", + "Owner": "DockerAssignment", + "Project": "assignment", + "env": "dev" + }, + "timeouts": null, + "vpc": true + }, + "sensitive_attributes": [], + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiZGVsZXRlIjoxODAwMDAwMDAwMDAsInJlYWQiOjkwMDAwMDAwMDAwMCwidXBkYXRlIjozMDAwMDAwMDAwMDB9fQ==", + "dependencies": [ + "aws_instance.my_instance_2", + "aws_key_pair.my_key", + "aws_security_group.my_sg", + "data.aws_ami.latest_amazon_linux", + "data.aws_vpc.default" + ] + } + ] + }, + { + "mode": "managed", + "type": "aws_instance", + "name": "my_instance", + "provider": "provider[\"registry.terraform.io/hashicorp/aws\"]", + "instances": [ + { + "schema_version": 1, + "attributes": { + "ami": "ami-052b9fbb6949f883a", + "arn": "arn:aws:ec2:us-east-1:345771349539:instance/i-08e6eb9f316248fb6", + "associate_public_ip_address": true, + "availability_zone": "us-east-1b", + "capacity_reservation_specification": [ + { + "capacity_reservation_preference": "open", + "capacity_reservation_target": [] + } + ], + "cpu_core_count": 1, + "cpu_options": [ + { + "amd_sev_snp": "", + "core_count": 1, + "threads_per_core": 1 + } + ], + "cpu_threads_per_core": 1, + "credit_specification": [ + { + "cpu_credits": "standard" + } + ], + "disable_api_stop": false, + "disable_api_termination": false, + "ebs_block_device": [], + "ebs_optimized": false, + "enclave_options": [ + { + "enabled": false + } + ], + "ephemeral_block_device": [], + "get_password_data": false, + "hibernation": false, + "host_id": "", + "host_resource_group_arn": null, + "iam_instance_profile": "", + "id": "i-08e6eb9f316248fb6", + "instance_initiated_shutdown_behavior": "stop", + "instance_lifecycle": "", + "instance_market_options": [], + "instance_state": "running", + "instance_type": "t2.micro", + "ipv6_address_count": 0, + "ipv6_addresses": [], + "key_name": "assignmentdocker-dev", + "launch_template": [], + "maintenance_options": [ + { + "auto_recovery": "default" + } + ], + "metadata_options": [ + { + "http_endpoint": "enabled", + "http_protocol_ipv6": "disabled", + "http_put_response_hop_limit": 1, + "http_tokens": "optional", + "instance_metadata_tags": "disabled" + } + ], + "monitoring": false, + "network_interface": [], + "outpost_arn": "", + "password_data": "", + "placement_group": "", + "placement_partition_number": 0, + "primary_network_interface_id": "eni-0d1a87fb44dbd5295", + "private_dns": "ip-172-31-93-39.ec2.internal", + "private_dns_name_options": [ + { + "enable_resource_name_dns_a_record": false, + "enable_resource_name_dns_aaaa_record": false, + "hostname_type": "ip-name" + } + ], + "private_ip": "172.31.93.39", + "public_dns": "ec2-54-91-130-75.compute-1.amazonaws.com", + "public_ip": "54.91.130.75", + "root_block_device": [ + { + "delete_on_termination": true, + "device_name": "/dev/xvda", + "encrypted": false, + "iops": 100, + "kms_key_id": "", + "tags": {}, + "tags_all": {}, + "throughput": 0, + "volume_id": "vol-026e2132d0a4ec271", + "volume_size": 8, + "volume_type": "gp2" + } + ], + "secondary_private_ips": [], + "security_groups": [ + "allow_ssh" + ], + "source_dest_check": true, + "spot_instance_request_id": "", + "subnet_id": "subnet-04ce7404327e72f5d", + "tags": { + "App": "Web", + "Name": "assignmentdocker-dev-my-instance-Linux", + "Owner": "DockerAssignment", + "Project": "assignment", + "env": "dev" + }, + "tags_all": { + "App": "Web", + "Name": "assignmentdocker-dev-my-instance-Linux", + "Owner": "DockerAssignment", + "Project": "assignment", + "env": "dev" + }, + "tenancy": "default", + "timeouts": null, + "user_data": null, + "user_data_base64": null, + "user_data_replace_on_change": false, + "volume_tags": null, + "vpc_security_group_ids": [ + "sg-01c6c4234a92ab72e" + ] + }, + "sensitive_attributes": [], + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6MTIwMDAwMDAwMDAwMCwicmVhZCI6OTAwMDAwMDAwMDAwLCJ1cGRhdGUiOjYwMDAwMDAwMDAwMH0sInNjaGVtYV92ZXJzaW9uIjoiMSJ9", + "dependencies": [ + "aws_key_pair.my_key", + "aws_security_group.my_sg", + "data.aws_ami.latest_amazon_linux", + "data.aws_vpc.default" + ], + "create_before_destroy": true + } + ] + }, + { + "mode": "managed", + "type": "aws_instance", + "name": "my_instance_1", + "provider": "provider[\"registry.terraform.io/hashicorp/aws\"]", + "instances": [ + { + "schema_version": 1, + "attributes": { + "ami": "ami-052b9fbb6949f883a", + "arn": "arn:aws:ec2:us-east-1:345771349539:instance/i-019ca8f09e4db89c8", + "associate_public_ip_address": true, + "availability_zone": "us-east-1b", + "capacity_reservation_specification": [ + { + "capacity_reservation_preference": "open", + "capacity_reservation_target": [] + } + ], + "cpu_core_count": 1, + "cpu_options": [ + { + "amd_sev_snp": "", + "core_count": 1, + "threads_per_core": 1 + } + ], + "cpu_threads_per_core": 1, + "credit_specification": [ + { + "cpu_credits": "standard" + } + ], + "disable_api_stop": false, + "disable_api_termination": false, + "ebs_block_device": [], + "ebs_optimized": false, + "enclave_options": [ + { + "enabled": false + } + ], + "ephemeral_block_device": [], + "get_password_data": false, + "hibernation": false, + "host_id": "", + "host_resource_group_arn": null, + "iam_instance_profile": "", + "id": "i-019ca8f09e4db89c8", + "instance_initiated_shutdown_behavior": "stop", + "instance_lifecycle": "", + "instance_market_options": [], + "instance_state": "running", + "instance_type": "t2.micro", + "ipv6_address_count": 0, + "ipv6_addresses": [], + "key_name": "assignmentdocker-dev", + "launch_template": [], + "maintenance_options": [ + { + "auto_recovery": "default" + } + ], + "metadata_options": [ + { + "http_endpoint": "enabled", + "http_protocol_ipv6": "disabled", + "http_put_response_hop_limit": 1, + "http_tokens": "optional", + "instance_metadata_tags": "disabled" + } + ], + "monitoring": false, + "network_interface": [], + "outpost_arn": "", + "password_data": "", + "placement_group": "", + "placement_partition_number": 0, + "primary_network_interface_id": "eni-0961d3d5a2cab1f25", + "private_dns": "ip-172-31-88-43.ec2.internal", + "private_dns_name_options": [ + { + "enable_resource_name_dns_a_record": false, + "enable_resource_name_dns_aaaa_record": false, + "hostname_type": "ip-name" + } + ], + "private_ip": "172.31.88.43", + "public_dns": "ec2-3-90-53-79.compute-1.amazonaws.com", + "public_ip": "3.90.53.79", + "root_block_device": [ + { + "delete_on_termination": true, + "device_name": "/dev/xvda", + "encrypted": false, + "iops": 100, + "kms_key_id": "", + "tags": {}, + "tags_all": {}, + "throughput": 0, + "volume_id": "vol-098a5cab91b1d0e8a", + "volume_size": 8, + "volume_type": "gp2" + } + ], + "secondary_private_ips": [], + "security_groups": [ + "allow_ssh" + ], + "source_dest_check": true, + "spot_instance_request_id": "", + "subnet_id": "subnet-04ce7404327e72f5d", + "tags": { + "App": "Web", + "Name": "assignmentdocker-dev-my-instance-1", + "Owner": "DockerAssignment", + "Project": "assignment", + "env": "dev" + }, + "tags_all": { + "App": "Web", + "Name": "assignmentdocker-dev-my-instance-1", + "Owner": "DockerAssignment", + "Project": "assignment", + "env": "dev" + }, + "tenancy": "default", + "timeouts": null, + "user_data": null, + "user_data_base64": null, + "user_data_replace_on_change": false, + "volume_tags": null, + "vpc_security_group_ids": [ + "sg-01c6c4234a92ab72e" + ] + }, + "sensitive_attributes": [], + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6MTIwMDAwMDAwMDAwMCwicmVhZCI6OTAwMDAwMDAwMDAwLCJ1cGRhdGUiOjYwMDAwMDAwMDAwMH0sInNjaGVtYV92ZXJzaW9uIjoiMSJ9", + "dependencies": [ + "aws_key_pair.my_key", + "aws_security_group.my_sg", + "data.aws_ami.latest_amazon_linux", + "data.aws_vpc.default" + ], + "create_before_destroy": true + } + ] + }, + { + "mode": "managed", + "type": "aws_instance", + "name": "my_instance_2", + "provider": "provider[\"registry.terraform.io/hashicorp/aws\"]", + "instances": [ + { + "schema_version": 1, + "attributes": { + "ami": "ami-052b9fbb6949f883a", + "arn": "arn:aws:ec2:us-east-1:345771349539:instance/i-0612ed9124246fb01", + "associate_public_ip_address": true, + "availability_zone": "us-east-1b", + "capacity_reservation_specification": [ + { + "capacity_reservation_preference": "open", + "capacity_reservation_target": [] + } + ], + "cpu_core_count": 1, + "cpu_options": [ + { + "amd_sev_snp": "", + "core_count": 1, + "threads_per_core": 1 + } + ], + "cpu_threads_per_core": 1, + "credit_specification": [ + { + "cpu_credits": "standard" + } + ], + "disable_api_stop": false, + "disable_api_termination": false, + "ebs_block_device": [], + "ebs_optimized": false, + "enclave_options": [ + { + "enabled": false + } + ], + "ephemeral_block_device": [], + "get_password_data": false, + "hibernation": false, + "host_id": "", + "host_resource_group_arn": null, + "iam_instance_profile": "", + "id": "i-0612ed9124246fb01", + "instance_initiated_shutdown_behavior": "stop", + "instance_lifecycle": "", + "instance_market_options": [], + "instance_state": "running", + "instance_type": "t2.micro", + "ipv6_address_count": 0, + "ipv6_addresses": [], + "key_name": "assignmentdocker-dev", + "launch_template": [], + "maintenance_options": [ + { + "auto_recovery": "default" + } + ], + "metadata_options": [ + { + "http_endpoint": "enabled", + "http_protocol_ipv6": "disabled", + "http_put_response_hop_limit": 1, + "http_tokens": "optional", + "instance_metadata_tags": "disabled" + } + ], + "monitoring": false, + "network_interface": [], + "outpost_arn": "", + "password_data": "", + "placement_group": "", + "placement_partition_number": 0, + "primary_network_interface_id": "eni-0be4318e5cb4eb111", + "private_dns": "ip-172-31-82-2.ec2.internal", + "private_dns_name_options": [ + { + "enable_resource_name_dns_a_record": false, + "enable_resource_name_dns_aaaa_record": false, + "hostname_type": "ip-name" + } + ], + "private_ip": "172.31.82.2", + "public_dns": "ec2-3-83-140-17.compute-1.amazonaws.com", + "public_ip": "3.83.140.17", + "root_block_device": [ + { + "delete_on_termination": true, + "device_name": "/dev/xvda", + "encrypted": false, + "iops": 100, + "kms_key_id": "", + "tags": {}, + "tags_all": {}, + "throughput": 0, + "volume_id": "vol-05467daac4c9fae73", + "volume_size": 8, + "volume_type": "gp2" + } + ], + "secondary_private_ips": [], + "security_groups": [ + "allow_ssh" + ], + "source_dest_check": true, + "spot_instance_request_id": "", + "subnet_id": "subnet-04ce7404327e72f5d", + "tags": { + "App": "Web", + "Name": "assignmentdocker-dev-my-instance-2", + "Owner": "DockerAssignment", + "Project": "assignment", + "env": "dev" + }, + "tags_all": { + "App": "Web", + "Name": "assignmentdocker-dev-my-instance-2", + "Owner": "DockerAssignment", + "Project": "assignment", + "env": "dev" + }, + "tenancy": "default", + "timeouts": null, + "user_data": null, + "user_data_base64": null, + "user_data_replace_on_change": false, + "volume_tags": null, + "vpc_security_group_ids": [ + "sg-01c6c4234a92ab72e" + ] + }, + "sensitive_attributes": [], + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6MTIwMDAwMDAwMDAwMCwicmVhZCI6OTAwMDAwMDAwMDAwLCJ1cGRhdGUiOjYwMDAwMDAwMDAwMH0sInNjaGVtYV92ZXJzaW9uIjoiMSJ9", + "dependencies": [ + "aws_key_pair.my_key", + "aws_security_group.my_sg", + "data.aws_ami.latest_amazon_linux", + "data.aws_vpc.default" + ], + "create_before_destroy": true + } + ] + }, + { + "mode": "managed", + "type": "aws_key_pair", + "name": "my_key", + "provider": "provider[\"registry.terraform.io/hashicorp/aws\"]", + "instances": [ + { + "schema_version": 1, + "attributes": { + "arn": "arn:aws:ec2:us-east-1:345771349539:key-pair/assignmentdocker-dev", + "fingerprint": "31:0d:58:d7:35:66:d2:1e:e0:32:50:5e:72:4d:39:b3", + "id": "assignmentdocker-dev", + "key_name": "assignmentdocker-dev", + "key_name_prefix": "", + "key_pair_id": "key-0871a922ae48b8d60", + "key_type": "rsa", + "public_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDOlcMjUwyJX+BQZ929PjHtWoJk/5X9EKBijHtnSsjzRDkdgtk4jY3qoQnyWgqwoYTjyyxcQJpN5WKYoZCKCNiAdjT3MpEmZoaqmbFHAEO67Ij71BBEmNICC0PBmFEVQNIy82iy0ljd1z53FFKZvLUAjrsPw9EZUhWujXNIKEuIkPY3ZSdiyaHoIS8H2IDKfGUPWoq1rwt3+5Up8CPM5y8zC7OEfXidK6k0Pagxf0Z4UmE4WjJc5n8UNUc3DVuTT0dqqhfntc/Ft8W+oYaIgJeKift6QxzN4Y8FAG3SmlSEqy1pCklFOOCtgXGVLc3M58stYGISEtOtL1YcEHowe17HvEF3gijiw9g1Tkuthc4JcJ29XqRL5NtBDmhUPWbmAB11Hmtp3y7Q4RUGQvQAOstBT4ZNhWTjKYisW1BMesr941FXslhPgo8k8GVA4wvs2Qt279HZbx709W4qdL6X3Bj++3WlCzCLAQUbs3SnhKckp3fqXNKrxfUqrIXXrbnjSBM= ec2-user@ip-172-31-20-209.ec2.internal", + "tags": {}, + "tags_all": {} + }, + "sensitive_attributes": [], + "private": "eyJzY2hlbWFfdmVyc2lvbiI6IjEifQ==", + "create_before_destroy": true + } + ] + }, + { + "mode": "managed", + "type": "aws_security_group", + "name": "my_sg", + "provider": "provider[\"registry.terraform.io/hashicorp/aws\"]", + "instances": [ + { + "schema_version": 1, + "attributes": { + "arn": "arn:aws:ec2:us-east-1:345771349539:security-group/sg-01c6c4234a92ab72e", + "description": "Allow SSH inbound traffic", + "egress": [ + { + "cidr_blocks": [ + "0.0.0.0/0" + ], + "description": "", + "from_port": 0, + "ipv6_cidr_blocks": [ + "::/0" + ], + "prefix_list_ids": [], + "protocol": "-1", + "security_groups": [], + "self": false, + "to_port": 0 + } + ], + "id": "sg-01c6c4234a92ab72e", + "ingress": [ + { + "cidr_blocks": [ + "0.0.0.0/0" + ], + "description": "SSH from everywhere", + "from_port": 22, + "ipv6_cidr_blocks": [ + "::/0" + ], + "prefix_list_ids": [], + "protocol": "tcp", + "security_groups": [], + "self": false, + "to_port": 22 + } + ], + "name": "allow_ssh", + "name_prefix": "", + "owner_id": "345771349539", + "revoke_rules_on_delete": false, + "tags": { + "App": "Web", + "Name": "assignmentdocker-dev-sg", + "Owner": "DockerAssignment", + "Project": "assignment", + "env": "dev" + }, + "tags_all": { + "App": "Web", + "Name": "assignmentdocker-dev-sg", + "Owner": "DockerAssignment", + "Project": "assignment", + "env": "dev" + }, + "timeouts": null, + "vpc_id": "vpc-0fe25bfc810e1d519" + }, + "sensitive_attributes": [], + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6OTAwMDAwMDAwMDAwfSwic2NoZW1hX3ZlcnNpb24iOiIxIn0=", + "dependencies": [ + "data.aws_vpc.default" + ], + "create_before_destroy": true + } + ] + } + ], + "check_results": null +} diff --git a/terraform/dev/instances/terraform.tfstate.backup b/terraform/dev/instances/terraform.tfstate.backup new file mode 100644 index 0000000..bc7745d --- /dev/null +++ b/terraform/dev/instances/terraform.tfstate.backup @@ -0,0 +1,243 @@ +{ + "version": 4, + "terraform_version": "1.9.6", + "serial": 10, + "lineage": "ca5d1e0f-4e38-d0e9-f5fe-3091027f23b0", + "outputs": {}, + "resources": [ + { + "mode": "data", + "type": "aws_ami", + "name": "latest_amazon_linux", + "provider": "provider[\"registry.terraform.io/hashicorp/aws\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "architecture": "x86_64", + "arn": "arn:aws:ec2:us-east-1::image/ami-052b9fbb6949f883a", + "block_device_mappings": [ + { + "device_name": "/dev/xvda", + "ebs": { + "delete_on_termination": "true", + "encrypted": "false", + "iops": "0", + "snapshot_id": "snap-0be4171a54ec9da0b", + "throughput": "0", + "volume_size": "8", + "volume_type": "gp2" + }, + "no_device": "", + "virtual_name": "" + } + ], + "boot_mode": "", + "creation_date": "2024-09-16T18:59:41.000Z", + "deprecation_time": "2025-07-01T00:00:00.000Z", + "description": "Amazon Linux 2 AMI 2.0.20240916.0 x86_64 HVM gp2", + "ena_support": true, + "executable_users": null, + "filter": [ + { + "name": "name", + "values": [ + "amzn2-ami-hvm-*-x86_64-gp2" + ] + } + ], + "hypervisor": "xen", + "id": "ami-052b9fbb6949f883a", + "image_id": "ami-052b9fbb6949f883a", + "image_location": "amazon/amzn2-ami-hvm-2.0.20240916.0-x86_64-gp2", + "image_owner_alias": "amazon", + "image_type": "machine", + "imds_support": "", + "include_deprecated": false, + "kernel_id": "", + "most_recent": true, + "name": "amzn2-ami-hvm-2.0.20240916.0-x86_64-gp2", + "name_regex": null, + "owner_id": "137112412989", + "owners": [ + "amazon" + ], + "platform": "", + "platform_details": "Linux/UNIX", + "product_codes": [], + "public": true, + "ramdisk_id": "", + "root_device_name": "/dev/xvda", + "root_device_type": "ebs", + "root_snapshot_id": "snap-0be4171a54ec9da0b", + "sriov_net_support": "simple", + "state": "available", + "state_reason": { + "code": "UNSET", + "message": "UNSET" + }, + "tags": {}, + "timeouts": null, + "tpm_support": "", + "usage_operation": "RunInstances", + "virtualization_type": "hvm" + }, + "sensitive_attributes": [] + } + ] + }, + { + "mode": "data", + "type": "aws_availability_zones", + "name": "available", + "provider": "provider[\"registry.terraform.io/hashicorp/aws\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "all_availability_zones": null, + "exclude_names": null, + "exclude_zone_ids": null, + "filter": null, + "group_names": [ + "us-east-1" + ], + "id": "us-east-1", + "names": [ + "us-east-1a", + "us-east-1b", + "us-east-1c", + "us-east-1d", + "us-east-1e", + "us-east-1f" + ], + "state": "available", + "timeouts": null, + "zone_ids": [ + "use1-az1", + "use1-az2", + "use1-az4", + "use1-az6", + "use1-az3", + "use1-az5" + ] + }, + "sensitive_attributes": [] + } + ] + }, + { + "mode": "data", + "type": "aws_vpc", + "name": "default", + "provider": "provider[\"registry.terraform.io/hashicorp/aws\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "arn": "arn:aws:ec2:us-east-1:345771349539:vpc/vpc-0fe25bfc810e1d519", + "cidr_block": "172.31.0.0/16", + "cidr_block_associations": [ + { + "association_id": "vpc-cidr-assoc-0c06c0bce6df7ec24", + "cidr_block": "172.31.0.0/16", + "state": "associated" + } + ], + "default": true, + "dhcp_options_id": "dopt-0b6c688c87b2861c5", + "enable_dns_hostnames": true, + "enable_dns_support": true, + "enable_network_address_usage_metrics": false, + "filter": null, + "id": "vpc-0fe25bfc810e1d519", + "instance_tenancy": "default", + "ipv6_association_id": "", + "ipv6_cidr_block": "", + "main_route_table_id": "rtb-0395b3b999ce80ba7", + "owner_id": "345771349539", + "state": null, + "tags": {}, + "timeouts": null + }, + "sensitive_attributes": [] + } + ] + }, + { + "mode": "managed", + "type": "aws_ecr_repository", + "name": "my_ecr_repo", + "provider": "provider[\"registry.terraform.io/hashicorp/aws\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "arn": "arn:aws:ecr:us-east-1:345771349539:repository/assignmentdocker-dev-ecr-repo", + "encryption_configuration": [ + { + "encryption_type": "AES256", + "kms_key": "" + } + ], + "force_delete": null, + "id": "assignmentdocker-dev-ecr-repo", + "image_scanning_configuration": [ + { + "scan_on_push": false + } + ], + "image_tag_mutability": "MUTABLE", + "name": "assignmentdocker-dev-ecr-repo", + "registry_id": "345771349539", + "repository_url": "345771349539.dkr.ecr.us-east-1.amazonaws.com/assignmentdocker-dev-ecr-repo", + "tags": { + "App": "Web", + "Name": "assignmentdocker-dev-ecr-repo", + "Owner": "DockerAssignment", + "Project": "assignment", + "env": "dev" + }, + "tags_all": { + "App": "Web", + "Name": "assignmentdocker-dev-ecr-repo", + "Owner": "DockerAssignment", + "Project": "assignment", + "env": "dev" + }, + "timeouts": null + }, + "sensitive_attributes": [], + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiZGVsZXRlIjoxMjAwMDAwMDAwMDAwfX0=" + } + ] + }, + { + "mode": "managed", + "type": "aws_key_pair", + "name": "my_key", + "provider": "provider[\"registry.terraform.io/hashicorp/aws\"]", + "instances": [ + { + "schema_version": 1, + "attributes": { + "arn": "arn:aws:ec2:us-east-1:345771349539:key-pair/assignmentdocker-dev", + "fingerprint": "31:0d:58:d7:35:66:d2:1e:e0:32:50:5e:72:4d:39:b3", + "id": "assignmentdocker-dev", + "key_name": "assignmentdocker-dev", + "key_name_prefix": "", + "key_pair_id": "key-0871a922ae48b8d60", + "key_type": "rsa", + "public_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDOlcMjUwyJX+BQZ929PjHtWoJk/5X9EKBijHtnSsjzRDkdgtk4jY3qoQnyWgqwoYTjyyxcQJpN5WKYoZCKCNiAdjT3MpEmZoaqmbFHAEO67Ij71BBEmNICC0PBmFEVQNIy82iy0ljd1z53FFKZvLUAjrsPw9EZUhWujXNIKEuIkPY3ZSdiyaHoIS8H2IDKfGUPWoq1rwt3+5Up8CPM5y8zC7OEfXidK6k0Pagxf0Z4UmE4WjJc5n8UNUc3DVuTT0dqqhfntc/Ft8W+oYaIgJeKift6QxzN4Y8FAG3SmlSEqy1pCklFOOCtgXGVLc3M58stYGISEtOtL1YcEHowe17HvEF3gijiw9g1Tkuthc4JcJ29XqRL5NtBDmhUPWbmAB11Hmtp3y7Q4RUGQvQAOstBT4ZNhWTjKYisW1BMesr941FXslhPgo8k8GVA4wvs2Qt279HZbx709W4qdL6X3Bj++3WlCzCLAQUbs3SnhKckp3fqXNKrxfUqrIXXrbnjSBM= ec2-user@ip-172-31-20-209.ec2.internal", + "tags": null, + "tags_all": {} + }, + "sensitive_attributes": [], + "private": "eyJzY2hlbWFfdmVyc2lvbiI6IjEifQ==", + "create_before_destroy": true + } + ] + } + ], + "check_results": null +} From 230d3a21efc223f3ff2e3a388a1daee425233efd Mon Sep 17 00:00:00 2001 From: Krishna Khatiwada Date: Sat, 28 Sep 2024 22:08:52 +0000 Subject: [PATCH 04/23] new code for mysql ecr added --- terraform/dev/instances/main.tf | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/terraform/dev/instances/main.tf b/terraform/dev/instances/main.tf index 320c8be..0bf88bc 100644 --- a/terraform/dev/instances/main.tf +++ b/terraform/dev/instances/main.tf @@ -169,3 +169,13 @@ resource "aws_ecr_repository" "my_ecr_repo" { } ) } +resource "aws_ecr_repository" "mysql_ecr_repo" { + name = lower("${local.name_prefix}-mysql-ecr-repo") + image_tag_mutability = "MUTABLE" + + tags = merge(local.default_tags, + { + "Name" = "${local.name_prefix}-mysql-ecr-repo" + } + ) +} \ No newline at end of file From 2d6fdf64844580c9efcc835f331b02fd4fe8262f Mon Sep 17 00:00:00 2001 From: Krishna Khatiwada Date: Sat, 28 Sep 2024 22:17:27 +0000 Subject: [PATCH 05/23] github workflow added --- .../.github/workflows/build-and-push.yml | 44 ++ terraform/dev/instances/terraform.tfstate | 128 +++- .../dev/instances/terraform.tfstate.backup | 710 +++++++++++++++++- 3 files changed, 839 insertions(+), 43 deletions(-) create mode 100644 terraform/dev/instances/.github/workflows/build-and-push.yml diff --git a/terraform/dev/instances/.github/workflows/build-and-push.yml b/terraform/dev/instances/.github/workflows/build-and-push.yml new file mode 100644 index 0000000..1c95f30 --- /dev/null +++ b/terraform/dev/instances/.github/workflows/build-and-push.yml @@ -0,0 +1,44 @@ +name: Build and Push to ECR + +on: + push: + branches: [ main ] + +env: + AWS_REGION: us-east-1 + ECR_REPOSITORY_APP: assignmentdocker-dev-ecr-repo + ECR_REPOSITORY_MYSQL: assignmentdocker-dev-mysql-ecr-repo +jobs: + build-and-push: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: ${{ env.AWS_REGION }} + + - name: Login to Amazon ECR + id: login-ecr + uses: aws-actions/amazon-ecr-login@v1 + + - name: Build, tag, and push application image to Amazon ECR + env: + ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} + IMAGE_TAG: ${{ github.sha }} + run: | + docker build -t $ECR_REGISTRY/$ECR_REPOSITORY_APP:$IMAGE_TAG . + docker push $ECR_REGISTRY/$ECR_REPOSITORY_APP:$IMAGE_TAG + + - name: Build, tag, and push MySQL image to Amazon ECR + env: + ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} + IMAGE_TAG: ${{ github.sha }} + run: | + docker build -t $ECR_REGISTRY/$ECR_REPOSITORY_MYSQL:$IMAGE_TAG -f Dockerfile.mysql . + docker push $ECR_REGISTRY/$ECR_REPOSITORY_MYSQL:$IMAGE_TAG \ No newline at end of file diff --git a/terraform/dev/instances/terraform.tfstate b/terraform/dev/instances/terraform.tfstate index e76bcce..c166fe0 100644 --- a/terraform/dev/instances/terraform.tfstate +++ b/terraform/dev/instances/terraform.tfstate @@ -1,7 +1,7 @@ { "version": 4, "terraform_version": "1.9.6", - "serial": 18, + "serial": 29, "lineage": "ca5d1e0f-4e38-d0e9-f5fe-3091027f23b0", "outputs": { "eip_my_instance": { @@ -225,6 +225,54 @@ } ] }, + { + "mode": "managed", + "type": "aws_ecr_repository", + "name": "mysql_ecr_repo", + "provider": "provider[\"registry.terraform.io/hashicorp/aws\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "arn": "arn:aws:ecr:us-east-1:345771349539:repository/assignmentdocker-dev-mysql-ecr-repo", + "encryption_configuration": [ + { + "encryption_type": "AES256", + "kms_key": "" + } + ], + "force_delete": null, + "id": "assignmentdocker-dev-mysql-ecr-repo", + "image_scanning_configuration": [ + { + "scan_on_push": false + } + ], + "image_tag_mutability": "MUTABLE", + "name": "assignmentdocker-dev-mysql-ecr-repo", + "registry_id": "345771349539", + "repository_url": "345771349539.dkr.ecr.us-east-1.amazonaws.com/assignmentdocker-dev-mysql-ecr-repo", + "tags": { + "App": "Web", + "Name": "assignmentdocker-dev-mysql-ecr-repo", + "Owner": "DockerAssignment", + "Project": "assignment", + "env": "dev" + }, + "tags_all": { + "App": "Web", + "Name": "assignmentdocker-dev-mysql-ecr-repo", + "Owner": "DockerAssignment", + "Project": "assignment", + "env": "dev" + }, + "timeouts": null + }, + "sensitive_attributes": [], + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiZGVsZXRlIjoxMjAwMDAwMDAwMDAwfX0=" + } + ] + }, { "mode": "managed", "type": "aws_eip", @@ -238,17 +286,17 @@ "allocation_id": "eipalloc-04870422c25df54d0", "arn": "arn:aws:ec2:us-east-1:345771349539:elastic-ip/eipalloc-04870422c25df54d0", "associate_with_private_ip": null, - "association_id": "eipassoc-03c694d927363814f", + "association_id": "eipassoc-005ccd31394450e11", "carrier_ip": "", "customer_owned_ip": "", "customer_owned_ipv4_pool": "", "domain": "vpc", "id": "eipalloc-04870422c25df54d0", - "instance": "i-08e6eb9f316248fb6", + "instance": "i-05d0997e82dcfdd10", "network_border_group": "us-east-1", - "network_interface": "eni-0d1a87fb44dbd5295", - "private_dns": "ip-172-31-93-39.ec2.internal", - "private_ip": "172.31.93.39", + "network_interface": "eni-0be62202b13a9b25b", + "private_dns": "ip-172-31-95-67.ec2.internal", + "private_ip": "172.31.95.67", "ptr_record": "", "public_dns": "ec2-52-55-167-209.compute-1.amazonaws.com", "public_ip": "52.55.167.209", @@ -295,17 +343,17 @@ "allocation_id": "eipalloc-0247c6ccc13ab9c2a", "arn": "arn:aws:ec2:us-east-1:345771349539:elastic-ip/eipalloc-0247c6ccc13ab9c2a", "associate_with_private_ip": null, - "association_id": "eipassoc-060efd4e02b834666", + "association_id": "eipassoc-0f57d597707f2a2e1", "carrier_ip": "", "customer_owned_ip": "", "customer_owned_ipv4_pool": "", "domain": "vpc", "id": "eipalloc-0247c6ccc13ab9c2a", - "instance": "i-019ca8f09e4db89c8", + "instance": "i-0f148ebd4baf910af", "network_border_group": "us-east-1", - "network_interface": "eni-0961d3d5a2cab1f25", - "private_dns": "ip-172-31-88-43.ec2.internal", - "private_ip": "172.31.88.43", + "network_interface": "eni-0a671d942ecf642df", + "private_dns": "ip-172-31-95-157.ec2.internal", + "private_ip": "172.31.95.157", "ptr_record": "", "public_dns": "ec2-3-226-21-184.compute-1.amazonaws.com", "public_ip": "3.226.21.184", @@ -352,17 +400,17 @@ "allocation_id": "eipalloc-067a198e8fca138fa", "arn": "arn:aws:ec2:us-east-1:345771349539:elastic-ip/eipalloc-067a198e8fca138fa", "associate_with_private_ip": null, - "association_id": "eipassoc-0db0ff3d55e3b1dd3", + "association_id": "eipassoc-054c8ee9d5fd189ec", "carrier_ip": "", "customer_owned_ip": "", "customer_owned_ipv4_pool": "", "domain": "vpc", "id": "eipalloc-067a198e8fca138fa", - "instance": "i-0612ed9124246fb01", + "instance": "i-08aca63cf8a3d82d9", "network_border_group": "us-east-1", - "network_interface": "eni-0be4318e5cb4eb111", - "private_dns": "ip-172-31-82-2.ec2.internal", - "private_ip": "172.31.82.2", + "network_interface": "eni-09a26a9cb29e82da6", + "private_dns": "ip-172-31-88-232.ec2.internal", + "private_ip": "172.31.88.232", "ptr_record": "", "public_dns": "ec2-98-82-226-52.compute-1.amazonaws.com", "public_ip": "98.82.226.52", @@ -406,7 +454,7 @@ "schema_version": 1, "attributes": { "ami": "ami-052b9fbb6949f883a", - "arn": "arn:aws:ec2:us-east-1:345771349539:instance/i-08e6eb9f316248fb6", + "arn": "arn:aws:ec2:us-east-1:345771349539:instance/i-05d0997e82dcfdd10", "associate_public_ip_address": true, "availability_zone": "us-east-1b", "capacity_reservation_specification": [ @@ -444,7 +492,7 @@ "host_id": "", "host_resource_group_arn": null, "iam_instance_profile": "", - "id": "i-08e6eb9f316248fb6", + "id": "i-05d0997e82dcfdd10", "instance_initiated_shutdown_behavior": "stop", "instance_lifecycle": "", "instance_market_options": [], @@ -474,8 +522,8 @@ "password_data": "", "placement_group": "", "placement_partition_number": 0, - "primary_network_interface_id": "eni-0d1a87fb44dbd5295", - "private_dns": "ip-172-31-93-39.ec2.internal", + "primary_network_interface_id": "eni-0be62202b13a9b25b", + "private_dns": "ip-172-31-95-67.ec2.internal", "private_dns_name_options": [ { "enable_resource_name_dns_a_record": false, @@ -483,9 +531,9 @@ "hostname_type": "ip-name" } ], - "private_ip": "172.31.93.39", - "public_dns": "ec2-54-91-130-75.compute-1.amazonaws.com", - "public_ip": "54.91.130.75", + "private_ip": "172.31.95.67", + "public_dns": "ec2-3-83-14-3.compute-1.amazonaws.com", + "public_ip": "3.83.14.3", "root_block_device": [ { "delete_on_termination": true, @@ -496,7 +544,7 @@ "tags": {}, "tags_all": {}, "throughput": 0, - "volume_id": "vol-026e2132d0a4ec271", + "volume_id": "vol-087897d76ba62691b", "volume_size": 8, "volume_type": "gp2" } @@ -554,7 +602,7 @@ "schema_version": 1, "attributes": { "ami": "ami-052b9fbb6949f883a", - "arn": "arn:aws:ec2:us-east-1:345771349539:instance/i-019ca8f09e4db89c8", + "arn": "arn:aws:ec2:us-east-1:345771349539:instance/i-0f148ebd4baf910af", "associate_public_ip_address": true, "availability_zone": "us-east-1b", "capacity_reservation_specification": [ @@ -592,7 +640,7 @@ "host_id": "", "host_resource_group_arn": null, "iam_instance_profile": "", - "id": "i-019ca8f09e4db89c8", + "id": "i-0f148ebd4baf910af", "instance_initiated_shutdown_behavior": "stop", "instance_lifecycle": "", "instance_market_options": [], @@ -622,8 +670,8 @@ "password_data": "", "placement_group": "", "placement_partition_number": 0, - "primary_network_interface_id": "eni-0961d3d5a2cab1f25", - "private_dns": "ip-172-31-88-43.ec2.internal", + "primary_network_interface_id": "eni-0a671d942ecf642df", + "private_dns": "ip-172-31-95-157.ec2.internal", "private_dns_name_options": [ { "enable_resource_name_dns_a_record": false, @@ -631,9 +679,9 @@ "hostname_type": "ip-name" } ], - "private_ip": "172.31.88.43", - "public_dns": "ec2-3-90-53-79.compute-1.amazonaws.com", - "public_ip": "3.90.53.79", + "private_ip": "172.31.95.157", + "public_dns": "ec2-34-239-120-155.compute-1.amazonaws.com", + "public_ip": "34.239.120.155", "root_block_device": [ { "delete_on_termination": true, @@ -644,7 +692,7 @@ "tags": {}, "tags_all": {}, "throughput": 0, - "volume_id": "vol-098a5cab91b1d0e8a", + "volume_id": "vol-0b6db89560a63d62a", "volume_size": 8, "volume_type": "gp2" } @@ -702,7 +750,7 @@ "schema_version": 1, "attributes": { "ami": "ami-052b9fbb6949f883a", - "arn": "arn:aws:ec2:us-east-1:345771349539:instance/i-0612ed9124246fb01", + "arn": "arn:aws:ec2:us-east-1:345771349539:instance/i-08aca63cf8a3d82d9", "associate_public_ip_address": true, "availability_zone": "us-east-1b", "capacity_reservation_specification": [ @@ -740,7 +788,7 @@ "host_id": "", "host_resource_group_arn": null, "iam_instance_profile": "", - "id": "i-0612ed9124246fb01", + "id": "i-08aca63cf8a3d82d9", "instance_initiated_shutdown_behavior": "stop", "instance_lifecycle": "", "instance_market_options": [], @@ -770,8 +818,8 @@ "password_data": "", "placement_group": "", "placement_partition_number": 0, - "primary_network_interface_id": "eni-0be4318e5cb4eb111", - "private_dns": "ip-172-31-82-2.ec2.internal", + "primary_network_interface_id": "eni-09a26a9cb29e82da6", + "private_dns": "ip-172-31-88-232.ec2.internal", "private_dns_name_options": [ { "enable_resource_name_dns_a_record": false, @@ -779,9 +827,9 @@ "hostname_type": "ip-name" } ], - "private_ip": "172.31.82.2", - "public_dns": "ec2-3-83-140-17.compute-1.amazonaws.com", - "public_ip": "3.83.140.17", + "private_ip": "172.31.88.232", + "public_dns": "ec2-18-205-190-145.compute-1.amazonaws.com", + "public_ip": "18.205.190.145", "root_block_device": [ { "delete_on_termination": true, @@ -792,7 +840,7 @@ "tags": {}, "tags_all": {}, "throughput": 0, - "volume_id": "vol-05467daac4c9fae73", + "volume_id": "vol-0f2e8021d32f612f7", "volume_size": 8, "volume_type": "gp2" } diff --git a/terraform/dev/instances/terraform.tfstate.backup b/terraform/dev/instances/terraform.tfstate.backup index bc7745d..e76bcce 100644 --- a/terraform/dev/instances/terraform.tfstate.backup +++ b/terraform/dev/instances/terraform.tfstate.backup @@ -1,9 +1,22 @@ { "version": 4, "terraform_version": "1.9.6", - "serial": 10, + "serial": 18, "lineage": "ca5d1e0f-4e38-d0e9-f5fe-3091027f23b0", - "outputs": {}, + "outputs": { + "eip_my_instance": { + "value": "52.55.167.209", + "type": "string" + }, + "eip_my_instance1": { + "value": "3.226.21.184", + "type": "string" + }, + "eip_my_instance2": { + "value": "98.82.226.52", + "type": "string" + } + }, "resources": [ { "mode": "data", @@ -212,6 +225,621 @@ } ] }, + { + "mode": "managed", + "type": "aws_eip", + "name": "static_eip_my_instance", + "provider": "provider[\"registry.terraform.io/hashicorp/aws\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "address": null, + "allocation_id": "eipalloc-04870422c25df54d0", + "arn": "arn:aws:ec2:us-east-1:345771349539:elastic-ip/eipalloc-04870422c25df54d0", + "associate_with_private_ip": null, + "association_id": "eipassoc-03c694d927363814f", + "carrier_ip": "", + "customer_owned_ip": "", + "customer_owned_ipv4_pool": "", + "domain": "vpc", + "id": "eipalloc-04870422c25df54d0", + "instance": "i-08e6eb9f316248fb6", + "network_border_group": "us-east-1", + "network_interface": "eni-0d1a87fb44dbd5295", + "private_dns": "ip-172-31-93-39.ec2.internal", + "private_ip": "172.31.93.39", + "ptr_record": "", + "public_dns": "ec2-52-55-167-209.compute-1.amazonaws.com", + "public_ip": "52.55.167.209", + "public_ipv4_pool": "amazon", + "tags": { + "App": "Web", + "Name": "assignmentdocker-dev-eip", + "Owner": "DockerAssignment", + "Project": "assignment", + "env": "dev" + }, + "tags_all": { + "App": "Web", + "Name": "assignmentdocker-dev-eip", + "Owner": "DockerAssignment", + "Project": "assignment", + "env": "dev" + }, + "timeouts": null, + "vpc": true + }, + "sensitive_attributes": [], + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiZGVsZXRlIjoxODAwMDAwMDAwMDAsInJlYWQiOjkwMDAwMDAwMDAwMCwidXBkYXRlIjozMDAwMDAwMDAwMDB9fQ==", + "dependencies": [ + "aws_instance.my_instance", + "aws_key_pair.my_key", + "aws_security_group.my_sg", + "data.aws_ami.latest_amazon_linux", + "data.aws_vpc.default" + ] + } + ] + }, + { + "mode": "managed", + "type": "aws_eip", + "name": "static_eip_my_instance_1", + "provider": "provider[\"registry.terraform.io/hashicorp/aws\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "address": null, + "allocation_id": "eipalloc-0247c6ccc13ab9c2a", + "arn": "arn:aws:ec2:us-east-1:345771349539:elastic-ip/eipalloc-0247c6ccc13ab9c2a", + "associate_with_private_ip": null, + "association_id": "eipassoc-060efd4e02b834666", + "carrier_ip": "", + "customer_owned_ip": "", + "customer_owned_ipv4_pool": "", + "domain": "vpc", + "id": "eipalloc-0247c6ccc13ab9c2a", + "instance": "i-019ca8f09e4db89c8", + "network_border_group": "us-east-1", + "network_interface": "eni-0961d3d5a2cab1f25", + "private_dns": "ip-172-31-88-43.ec2.internal", + "private_ip": "172.31.88.43", + "ptr_record": "", + "public_dns": "ec2-3-226-21-184.compute-1.amazonaws.com", + "public_ip": "3.226.21.184", + "public_ipv4_pool": "amazon", + "tags": { + "App": "Web", + "Name": "assignmentdocker-dev-eip", + "Owner": "DockerAssignment", + "Project": "assignment", + "env": "dev" + }, + "tags_all": { + "App": "Web", + "Name": "assignmentdocker-dev-eip", + "Owner": "DockerAssignment", + "Project": "assignment", + "env": "dev" + }, + "timeouts": null, + "vpc": true + }, + "sensitive_attributes": [], + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiZGVsZXRlIjoxODAwMDAwMDAwMDAsInJlYWQiOjkwMDAwMDAwMDAwMCwidXBkYXRlIjozMDAwMDAwMDAwMDB9fQ==", + "dependencies": [ + "aws_instance.my_instance_1", + "aws_key_pair.my_key", + "aws_security_group.my_sg", + "data.aws_ami.latest_amazon_linux", + "data.aws_vpc.default" + ] + } + ] + }, + { + "mode": "managed", + "type": "aws_eip", + "name": "static_eip_my_instance_2", + "provider": "provider[\"registry.terraform.io/hashicorp/aws\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "address": null, + "allocation_id": "eipalloc-067a198e8fca138fa", + "arn": "arn:aws:ec2:us-east-1:345771349539:elastic-ip/eipalloc-067a198e8fca138fa", + "associate_with_private_ip": null, + "association_id": "eipassoc-0db0ff3d55e3b1dd3", + "carrier_ip": "", + "customer_owned_ip": "", + "customer_owned_ipv4_pool": "", + "domain": "vpc", + "id": "eipalloc-067a198e8fca138fa", + "instance": "i-0612ed9124246fb01", + "network_border_group": "us-east-1", + "network_interface": "eni-0be4318e5cb4eb111", + "private_dns": "ip-172-31-82-2.ec2.internal", + "private_ip": "172.31.82.2", + "ptr_record": "", + "public_dns": "ec2-98-82-226-52.compute-1.amazonaws.com", + "public_ip": "98.82.226.52", + "public_ipv4_pool": "amazon", + "tags": { + "App": "Web", + "Name": "assignmentdocker-dev-eip", + "Owner": "DockerAssignment", + "Project": "assignment", + "env": "dev" + }, + "tags_all": { + "App": "Web", + "Name": "assignmentdocker-dev-eip", + "Owner": "DockerAssignment", + "Project": "assignment", + "env": "dev" + }, + "timeouts": null, + "vpc": true + }, + "sensitive_attributes": [], + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiZGVsZXRlIjoxODAwMDAwMDAwMDAsInJlYWQiOjkwMDAwMDAwMDAwMCwidXBkYXRlIjozMDAwMDAwMDAwMDB9fQ==", + "dependencies": [ + "aws_instance.my_instance_2", + "aws_key_pair.my_key", + "aws_security_group.my_sg", + "data.aws_ami.latest_amazon_linux", + "data.aws_vpc.default" + ] + } + ] + }, + { + "mode": "managed", + "type": "aws_instance", + "name": "my_instance", + "provider": "provider[\"registry.terraform.io/hashicorp/aws\"]", + "instances": [ + { + "schema_version": 1, + "attributes": { + "ami": "ami-052b9fbb6949f883a", + "arn": "arn:aws:ec2:us-east-1:345771349539:instance/i-08e6eb9f316248fb6", + "associate_public_ip_address": true, + "availability_zone": "us-east-1b", + "capacity_reservation_specification": [ + { + "capacity_reservation_preference": "open", + "capacity_reservation_target": [] + } + ], + "cpu_core_count": 1, + "cpu_options": [ + { + "amd_sev_snp": "", + "core_count": 1, + "threads_per_core": 1 + } + ], + "cpu_threads_per_core": 1, + "credit_specification": [ + { + "cpu_credits": "standard" + } + ], + "disable_api_stop": false, + "disable_api_termination": false, + "ebs_block_device": [], + "ebs_optimized": false, + "enclave_options": [ + { + "enabled": false + } + ], + "ephemeral_block_device": [], + "get_password_data": false, + "hibernation": false, + "host_id": "", + "host_resource_group_arn": null, + "iam_instance_profile": "", + "id": "i-08e6eb9f316248fb6", + "instance_initiated_shutdown_behavior": "stop", + "instance_lifecycle": "", + "instance_market_options": [], + "instance_state": "running", + "instance_type": "t2.micro", + "ipv6_address_count": 0, + "ipv6_addresses": [], + "key_name": "assignmentdocker-dev", + "launch_template": [], + "maintenance_options": [ + { + "auto_recovery": "default" + } + ], + "metadata_options": [ + { + "http_endpoint": "enabled", + "http_protocol_ipv6": "disabled", + "http_put_response_hop_limit": 1, + "http_tokens": "optional", + "instance_metadata_tags": "disabled" + } + ], + "monitoring": false, + "network_interface": [], + "outpost_arn": "", + "password_data": "", + "placement_group": "", + "placement_partition_number": 0, + "primary_network_interface_id": "eni-0d1a87fb44dbd5295", + "private_dns": "ip-172-31-93-39.ec2.internal", + "private_dns_name_options": [ + { + "enable_resource_name_dns_a_record": false, + "enable_resource_name_dns_aaaa_record": false, + "hostname_type": "ip-name" + } + ], + "private_ip": "172.31.93.39", + "public_dns": "ec2-54-91-130-75.compute-1.amazonaws.com", + "public_ip": "54.91.130.75", + "root_block_device": [ + { + "delete_on_termination": true, + "device_name": "/dev/xvda", + "encrypted": false, + "iops": 100, + "kms_key_id": "", + "tags": {}, + "tags_all": {}, + "throughput": 0, + "volume_id": "vol-026e2132d0a4ec271", + "volume_size": 8, + "volume_type": "gp2" + } + ], + "secondary_private_ips": [], + "security_groups": [ + "allow_ssh" + ], + "source_dest_check": true, + "spot_instance_request_id": "", + "subnet_id": "subnet-04ce7404327e72f5d", + "tags": { + "App": "Web", + "Name": "assignmentdocker-dev-my-instance-Linux", + "Owner": "DockerAssignment", + "Project": "assignment", + "env": "dev" + }, + "tags_all": { + "App": "Web", + "Name": "assignmentdocker-dev-my-instance-Linux", + "Owner": "DockerAssignment", + "Project": "assignment", + "env": "dev" + }, + "tenancy": "default", + "timeouts": null, + "user_data": null, + "user_data_base64": null, + "user_data_replace_on_change": false, + "volume_tags": null, + "vpc_security_group_ids": [ + "sg-01c6c4234a92ab72e" + ] + }, + "sensitive_attributes": [], + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6MTIwMDAwMDAwMDAwMCwicmVhZCI6OTAwMDAwMDAwMDAwLCJ1cGRhdGUiOjYwMDAwMDAwMDAwMH0sInNjaGVtYV92ZXJzaW9uIjoiMSJ9", + "dependencies": [ + "aws_key_pair.my_key", + "aws_security_group.my_sg", + "data.aws_ami.latest_amazon_linux", + "data.aws_vpc.default" + ], + "create_before_destroy": true + } + ] + }, + { + "mode": "managed", + "type": "aws_instance", + "name": "my_instance_1", + "provider": "provider[\"registry.terraform.io/hashicorp/aws\"]", + "instances": [ + { + "schema_version": 1, + "attributes": { + "ami": "ami-052b9fbb6949f883a", + "arn": "arn:aws:ec2:us-east-1:345771349539:instance/i-019ca8f09e4db89c8", + "associate_public_ip_address": true, + "availability_zone": "us-east-1b", + "capacity_reservation_specification": [ + { + "capacity_reservation_preference": "open", + "capacity_reservation_target": [] + } + ], + "cpu_core_count": 1, + "cpu_options": [ + { + "amd_sev_snp": "", + "core_count": 1, + "threads_per_core": 1 + } + ], + "cpu_threads_per_core": 1, + "credit_specification": [ + { + "cpu_credits": "standard" + } + ], + "disable_api_stop": false, + "disable_api_termination": false, + "ebs_block_device": [], + "ebs_optimized": false, + "enclave_options": [ + { + "enabled": false + } + ], + "ephemeral_block_device": [], + "get_password_data": false, + "hibernation": false, + "host_id": "", + "host_resource_group_arn": null, + "iam_instance_profile": "", + "id": "i-019ca8f09e4db89c8", + "instance_initiated_shutdown_behavior": "stop", + "instance_lifecycle": "", + "instance_market_options": [], + "instance_state": "running", + "instance_type": "t2.micro", + "ipv6_address_count": 0, + "ipv6_addresses": [], + "key_name": "assignmentdocker-dev", + "launch_template": [], + "maintenance_options": [ + { + "auto_recovery": "default" + } + ], + "metadata_options": [ + { + "http_endpoint": "enabled", + "http_protocol_ipv6": "disabled", + "http_put_response_hop_limit": 1, + "http_tokens": "optional", + "instance_metadata_tags": "disabled" + } + ], + "monitoring": false, + "network_interface": [], + "outpost_arn": "", + "password_data": "", + "placement_group": "", + "placement_partition_number": 0, + "primary_network_interface_id": "eni-0961d3d5a2cab1f25", + "private_dns": "ip-172-31-88-43.ec2.internal", + "private_dns_name_options": [ + { + "enable_resource_name_dns_a_record": false, + "enable_resource_name_dns_aaaa_record": false, + "hostname_type": "ip-name" + } + ], + "private_ip": "172.31.88.43", + "public_dns": "ec2-3-90-53-79.compute-1.amazonaws.com", + "public_ip": "3.90.53.79", + "root_block_device": [ + { + "delete_on_termination": true, + "device_name": "/dev/xvda", + "encrypted": false, + "iops": 100, + "kms_key_id": "", + "tags": {}, + "tags_all": {}, + "throughput": 0, + "volume_id": "vol-098a5cab91b1d0e8a", + "volume_size": 8, + "volume_type": "gp2" + } + ], + "secondary_private_ips": [], + "security_groups": [ + "allow_ssh" + ], + "source_dest_check": true, + "spot_instance_request_id": "", + "subnet_id": "subnet-04ce7404327e72f5d", + "tags": { + "App": "Web", + "Name": "assignmentdocker-dev-my-instance-1", + "Owner": "DockerAssignment", + "Project": "assignment", + "env": "dev" + }, + "tags_all": { + "App": "Web", + "Name": "assignmentdocker-dev-my-instance-1", + "Owner": "DockerAssignment", + "Project": "assignment", + "env": "dev" + }, + "tenancy": "default", + "timeouts": null, + "user_data": null, + "user_data_base64": null, + "user_data_replace_on_change": false, + "volume_tags": null, + "vpc_security_group_ids": [ + "sg-01c6c4234a92ab72e" + ] + }, + "sensitive_attributes": [], + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6MTIwMDAwMDAwMDAwMCwicmVhZCI6OTAwMDAwMDAwMDAwLCJ1cGRhdGUiOjYwMDAwMDAwMDAwMH0sInNjaGVtYV92ZXJzaW9uIjoiMSJ9", + "dependencies": [ + "aws_key_pair.my_key", + "aws_security_group.my_sg", + "data.aws_ami.latest_amazon_linux", + "data.aws_vpc.default" + ], + "create_before_destroy": true + } + ] + }, + { + "mode": "managed", + "type": "aws_instance", + "name": "my_instance_2", + "provider": "provider[\"registry.terraform.io/hashicorp/aws\"]", + "instances": [ + { + "schema_version": 1, + "attributes": { + "ami": "ami-052b9fbb6949f883a", + "arn": "arn:aws:ec2:us-east-1:345771349539:instance/i-0612ed9124246fb01", + "associate_public_ip_address": true, + "availability_zone": "us-east-1b", + "capacity_reservation_specification": [ + { + "capacity_reservation_preference": "open", + "capacity_reservation_target": [] + } + ], + "cpu_core_count": 1, + "cpu_options": [ + { + "amd_sev_snp": "", + "core_count": 1, + "threads_per_core": 1 + } + ], + "cpu_threads_per_core": 1, + "credit_specification": [ + { + "cpu_credits": "standard" + } + ], + "disable_api_stop": false, + "disable_api_termination": false, + "ebs_block_device": [], + "ebs_optimized": false, + "enclave_options": [ + { + "enabled": false + } + ], + "ephemeral_block_device": [], + "get_password_data": false, + "hibernation": false, + "host_id": "", + "host_resource_group_arn": null, + "iam_instance_profile": "", + "id": "i-0612ed9124246fb01", + "instance_initiated_shutdown_behavior": "stop", + "instance_lifecycle": "", + "instance_market_options": [], + "instance_state": "running", + "instance_type": "t2.micro", + "ipv6_address_count": 0, + "ipv6_addresses": [], + "key_name": "assignmentdocker-dev", + "launch_template": [], + "maintenance_options": [ + { + "auto_recovery": "default" + } + ], + "metadata_options": [ + { + "http_endpoint": "enabled", + "http_protocol_ipv6": "disabled", + "http_put_response_hop_limit": 1, + "http_tokens": "optional", + "instance_metadata_tags": "disabled" + } + ], + "monitoring": false, + "network_interface": [], + "outpost_arn": "", + "password_data": "", + "placement_group": "", + "placement_partition_number": 0, + "primary_network_interface_id": "eni-0be4318e5cb4eb111", + "private_dns": "ip-172-31-82-2.ec2.internal", + "private_dns_name_options": [ + { + "enable_resource_name_dns_a_record": false, + "enable_resource_name_dns_aaaa_record": false, + "hostname_type": "ip-name" + } + ], + "private_ip": "172.31.82.2", + "public_dns": "ec2-3-83-140-17.compute-1.amazonaws.com", + "public_ip": "3.83.140.17", + "root_block_device": [ + { + "delete_on_termination": true, + "device_name": "/dev/xvda", + "encrypted": false, + "iops": 100, + "kms_key_id": "", + "tags": {}, + "tags_all": {}, + "throughput": 0, + "volume_id": "vol-05467daac4c9fae73", + "volume_size": 8, + "volume_type": "gp2" + } + ], + "secondary_private_ips": [], + "security_groups": [ + "allow_ssh" + ], + "source_dest_check": true, + "spot_instance_request_id": "", + "subnet_id": "subnet-04ce7404327e72f5d", + "tags": { + "App": "Web", + "Name": "assignmentdocker-dev-my-instance-2", + "Owner": "DockerAssignment", + "Project": "assignment", + "env": "dev" + }, + "tags_all": { + "App": "Web", + "Name": "assignmentdocker-dev-my-instance-2", + "Owner": "DockerAssignment", + "Project": "assignment", + "env": "dev" + }, + "tenancy": "default", + "timeouts": null, + "user_data": null, + "user_data_base64": null, + "user_data_replace_on_change": false, + "volume_tags": null, + "vpc_security_group_ids": [ + "sg-01c6c4234a92ab72e" + ] + }, + "sensitive_attributes": [], + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6MTIwMDAwMDAwMDAwMCwicmVhZCI6OTAwMDAwMDAwMDAwLCJ1cGRhdGUiOjYwMDAwMDAwMDAwMH0sInNjaGVtYV92ZXJzaW9uIjoiMSJ9", + "dependencies": [ + "aws_key_pair.my_key", + "aws_security_group.my_sg", + "data.aws_ami.latest_amazon_linux", + "data.aws_vpc.default" + ], + "create_before_destroy": true + } + ] + }, { "mode": "managed", "type": "aws_key_pair", @@ -229,7 +857,7 @@ "key_pair_id": "key-0871a922ae48b8d60", "key_type": "rsa", "public_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDOlcMjUwyJX+BQZ929PjHtWoJk/5X9EKBijHtnSsjzRDkdgtk4jY3qoQnyWgqwoYTjyyxcQJpN5WKYoZCKCNiAdjT3MpEmZoaqmbFHAEO67Ij71BBEmNICC0PBmFEVQNIy82iy0ljd1z53FFKZvLUAjrsPw9EZUhWujXNIKEuIkPY3ZSdiyaHoIS8H2IDKfGUPWoq1rwt3+5Up8CPM5y8zC7OEfXidK6k0Pagxf0Z4UmE4WjJc5n8UNUc3DVuTT0dqqhfntc/Ft8W+oYaIgJeKift6QxzN4Y8FAG3SmlSEqy1pCklFOOCtgXGVLc3M58stYGISEtOtL1YcEHowe17HvEF3gijiw9g1Tkuthc4JcJ29XqRL5NtBDmhUPWbmAB11Hmtp3y7Q4RUGQvQAOstBT4ZNhWTjKYisW1BMesr941FXslhPgo8k8GVA4wvs2Qt279HZbx709W4qdL6X3Bj++3WlCzCLAQUbs3SnhKckp3fqXNKrxfUqrIXXrbnjSBM= ec2-user@ip-172-31-20-209.ec2.internal", - "tags": null, + "tags": {}, "tags_all": {} }, "sensitive_attributes": [], @@ -237,6 +865,82 @@ "create_before_destroy": true } ] + }, + { + "mode": "managed", + "type": "aws_security_group", + "name": "my_sg", + "provider": "provider[\"registry.terraform.io/hashicorp/aws\"]", + "instances": [ + { + "schema_version": 1, + "attributes": { + "arn": "arn:aws:ec2:us-east-1:345771349539:security-group/sg-01c6c4234a92ab72e", + "description": "Allow SSH inbound traffic", + "egress": [ + { + "cidr_blocks": [ + "0.0.0.0/0" + ], + "description": "", + "from_port": 0, + "ipv6_cidr_blocks": [ + "::/0" + ], + "prefix_list_ids": [], + "protocol": "-1", + "security_groups": [], + "self": false, + "to_port": 0 + } + ], + "id": "sg-01c6c4234a92ab72e", + "ingress": [ + { + "cidr_blocks": [ + "0.0.0.0/0" + ], + "description": "SSH from everywhere", + "from_port": 22, + "ipv6_cidr_blocks": [ + "::/0" + ], + "prefix_list_ids": [], + "protocol": "tcp", + "security_groups": [], + "self": false, + "to_port": 22 + } + ], + "name": "allow_ssh", + "name_prefix": "", + "owner_id": "345771349539", + "revoke_rules_on_delete": false, + "tags": { + "App": "Web", + "Name": "assignmentdocker-dev-sg", + "Owner": "DockerAssignment", + "Project": "assignment", + "env": "dev" + }, + "tags_all": { + "App": "Web", + "Name": "assignmentdocker-dev-sg", + "Owner": "DockerAssignment", + "Project": "assignment", + "env": "dev" + }, + "timeouts": null, + "vpc_id": "vpc-0fe25bfc810e1d519" + }, + "sensitive_attributes": [], + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6OTAwMDAwMDAwMDAwfSwic2NoZW1hX3ZlcnNpb24iOiIxIn0=", + "dependencies": [ + "data.aws_vpc.default" + ], + "create_before_destroy": true + } + ] } ], "check_results": null From 62f47e1533b56621cd2c7950acef3cdbe5564dc6 Mon Sep 17 00:00:00 2001 From: Krishna Khatiwada Date: Sat, 28 Sep 2024 22:23:08 +0000 Subject: [PATCH 06/23] mysql docker file changed --- terraform/modules/globalvars/output.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/modules/globalvars/output.tf b/terraform/modules/globalvars/output.tf index 5f23812..3153281 100644 --- a/terraform/modules/globalvars/output.tf +++ b/terraform/modules/globalvars/output.tf @@ -9,5 +9,5 @@ output "default_tags" { # Prefix to identify resources output "prefix" { - value = "assignment1" + value = "assignmentdocker" } \ No newline at end of file From b54b8c9becdc7efc73b4667882ad3fed29aba70a Mon Sep 17 00:00:00 2001 From: Krishna Khatiwada Date: Sat, 28 Sep 2024 22:36:08 +0000 Subject: [PATCH 07/23] docker mysql file added --- Dockerfile.mysql | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 Dockerfile.mysql diff --git a/Dockerfile.mysql b/Dockerfile.mysql new file mode 100644 index 0000000..0aa1124 --- /dev/null +++ b/Dockerfile.mysql @@ -0,0 +1,5 @@ +FROM mysql:8.0 + +COPY ./mysql.sql /tmp + +CMD [ "mysqld", "--init-file=/tmp/mysql.sql" ] \ No newline at end of file From b853089b7408f19c60c55dffcc0f440d85575fed Mon Sep 17 00:00:00 2001 From: Krishna Khatiwada Date: Sat, 28 Sep 2024 22:37:22 +0000 Subject: [PATCH 08/23] old docker mysql file removed --- Dockerfile_mysql | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 Dockerfile_mysql diff --git a/Dockerfile_mysql b/Dockerfile_mysql deleted file mode 100644 index 0aa1124..0000000 --- a/Dockerfile_mysql +++ /dev/null @@ -1,5 +0,0 @@ -FROM mysql:8.0 - -COPY ./mysql.sql /tmp - -CMD [ "mysqld", "--init-file=/tmp/mysql.sql" ] \ No newline at end of file From 62f89cd6530904bd4c482ded0176e7d25af07f2e Mon Sep 17 00:00:00 2001 From: Krishna Khatiwada Date: Sat, 28 Sep 2024 18:37:56 -0400 Subject: [PATCH 09/23] workflow.yml --- .github/workflows/main.yml | 44 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..787fa5c --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,44 @@ +name: Build and Push to ECR + +on: + push: + branches: [ main ] + +env: + AWS_REGION: us-east-1 + ECR_REPOSITORY_APP: assignmentdocker-dev-ecr-repo + ECR_REPOSITORY_MYSQL: assignmentdocker-dev-mysql-ecr-repo +jobs: + build-and-push: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: ${{ env.AWS_REGION }} + + - name: Login to Amazon ECR + id: login-ecr + uses: aws-actions/amazon-ecr-login@v1 + + - name: Build, tag, and push application image to Amazon ECR + env: + ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} + IMAGE_TAG: ${{ github.sha }} + run: | + docker build -t $ECR_REGISTRY/$ECR_REPOSITORY_APP:$IMAGE_TAG . + docker push $ECR_REGISTRY/$ECR_REPOSITORY_APP:$IMAGE_TAG + + - name: Build, tag, and push MySQL image to Amazon ECR + env: + ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} + IMAGE_TAG: ${{ github.sha }} + run: | + docker build -t $ECR_REGISTRY/$ECR_REPOSITORY_MYSQL:$IMAGE_TAG -f Dockerfile.mysql . + docker push $ECR_REGISTRY/$ECR_REPOSITORY_MYSQL:$IMAGE_TAG From 3c681f0bd8c77cff81617d84909b1f310d58e3d7 Mon Sep 17 00:00:00 2001 From: Krishna Khatiwada Date: Sat, 28 Sep 2024 22:42:51 +0000 Subject: [PATCH 10/23] solved --- .../.github/workflows/build-and-push.yml | 44 ------------------- 1 file changed, 44 deletions(-) delete mode 100644 terraform/dev/instances/.github/workflows/build-and-push.yml diff --git a/terraform/dev/instances/.github/workflows/build-and-push.yml b/terraform/dev/instances/.github/workflows/build-and-push.yml deleted file mode 100644 index 1c95f30..0000000 --- a/terraform/dev/instances/.github/workflows/build-and-push.yml +++ /dev/null @@ -1,44 +0,0 @@ -name: Build and Push to ECR - -on: - push: - branches: [ main ] - -env: - AWS_REGION: us-east-1 - ECR_REPOSITORY_APP: assignmentdocker-dev-ecr-repo - ECR_REPOSITORY_MYSQL: assignmentdocker-dev-mysql-ecr-repo -jobs: - build-and-push: - runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@v2 - - - name: Configure AWS credentials - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: ${{ env.AWS_REGION }} - - - name: Login to Amazon ECR - id: login-ecr - uses: aws-actions/amazon-ecr-login@v1 - - - name: Build, tag, and push application image to Amazon ECR - env: - ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} - IMAGE_TAG: ${{ github.sha }} - run: | - docker build -t $ECR_REGISTRY/$ECR_REPOSITORY_APP:$IMAGE_TAG . - docker push $ECR_REGISTRY/$ECR_REPOSITORY_APP:$IMAGE_TAG - - - name: Build, tag, and push MySQL image to Amazon ECR - env: - ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} - IMAGE_TAG: ${{ github.sha }} - run: | - docker build -t $ECR_REGISTRY/$ECR_REPOSITORY_MYSQL:$IMAGE_TAG -f Dockerfile.mysql . - docker push $ECR_REGISTRY/$ECR_REPOSITORY_MYSQL:$IMAGE_TAG \ No newline at end of file From 738179081723252b0e89c9b09c76b617eefc2119 Mon Sep 17 00:00:00 2001 From: Krishna Khatiwada Date: Sat, 28 Sep 2024 22:46:00 +0000 Subject: [PATCH 11/23] changes in workflow code --- .github/workflows/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 787fa5c..15ec024 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -19,6 +19,7 @@ jobs: - name: Configure AWS credentials uses: aws-actions/configure-aws-credentials@v1 with: + aws-session_token: ${{ secrects.AWS_SESSION_TOKEN }} aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} aws-region: ${{ env.AWS_REGION }} From 7b62aa1a94030d8a2ccb89efb4a21df0af9fe08a Mon Sep 17 00:00:00 2001 From: Krishna Khatiwada Date: Sat, 28 Sep 2024 22:51:08 +0000 Subject: [PATCH 12/23] workflow error solved --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 15ec024..844fe6e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -19,7 +19,7 @@ jobs: - name: Configure AWS credentials uses: aws-actions/configure-aws-credentials@v1 with: - aws-session_token: ${{ secrects.AWS_SESSION_TOKEN }} + aws-session_token: ${{ secrets.AWS_SESSION_TOKEN }} aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} aws-region: ${{ env.AWS_REGION }} From 7e6c8b5ed48a4cfe14a569de969223a205d906e1 Mon Sep 17 00:00:00 2001 From: Krishna Khatiwada Date: Sat, 28 Sep 2024 22:53:12 +0000 Subject: [PATCH 13/23] workflow error solved1 --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 844fe6e..9acdd6a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -19,7 +19,7 @@ jobs: - name: Configure AWS credentials uses: aws-actions/configure-aws-credentials@v1 with: - aws-session_token: ${{ secrets.AWS_SESSION_TOKEN }} + # aws-session_token: ${{ secrets.AWS_SESSION_TOKEN }} aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} aws-region: ${{ env.AWS_REGION }} From 9f59a2b7c9219471dcaf96ee1585fb8ed927e32e Mon Sep 17 00:00:00 2001 From: Krishna Khatiwada Date: Sat, 28 Sep 2024 22:58:18 +0000 Subject: [PATCH 14/23] workflow error solved2 --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9acdd6a..d4c1ca8 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -19,10 +19,10 @@ jobs: - name: Configure AWS credentials uses: aws-actions/configure-aws-credentials@v1 with: - # aws-session_token: ${{ secrets.AWS_SESSION_TOKEN }} aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} aws-region: ${{ env.AWS_REGION }} + aws-session-token: ${{ secrets.AWS_SESSION_TOKEN }} - name: Login to Amazon ECR id: login-ecr From bbc564e5cd7cc1db811ea64516b741945fb3fca3 Mon Sep 17 00:00:00 2001 From: Krishna Khatiwada Date: Mon, 30 Sep 2024 16:20:21 +0000 Subject: [PATCH 15/23] requirement changed --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index 81d430f..b00262a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ flask==2.0.3 pymysql==1.0.2 cryptography==38.0.1 +werkzeug==2.0.3 \ No newline at end of file From 9d6c4872e58d8c3ebd54e7443246a8ac39a06a60 Mon Sep 17 00:00:00 2001 From: Krishna Khatiwada Date: Mon, 30 Sep 2024 16:28:34 +0000 Subject: [PATCH 16/23] checking git actions --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ed2402b..cf5538f 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # Install the required MySQL package - +# checked sudo apt-get update -y sudo apt-get install mysql-client -y From 50a2062fea52b2d7158d982d637ededc9543ba02 Mon Sep 17 00:00:00 2001 From: Krishna Khatiwada Date: Mon, 30 Sep 2024 16:46:12 +0000 Subject: [PATCH 17/23] updated pull request only for CI/CD --- .github/workflows/main.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d4c1ca8..67f66b8 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,7 +1,8 @@ -name: Build and Push to ECR +name: CI-CD of ECR on: - push: + pull_request: + types: -closed branches: [ main ] env: From 9009735f4d5244825afa276ce03ecad40174a057 Mon Sep 17 00:00:00 2001 From: Krishna Khatiwada Date: Mon, 30 Sep 2024 16:50:34 +0000 Subject: [PATCH 18/23] updated indentation pull request only for CI/CD --- .github/workflows/main.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 67f66b8..b2fa189 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -2,13 +2,14 @@ name: CI-CD of ECR on: pull_request: - types: -closed - branches: [ main ] + types: [closed] # Use brackets for proper syntax + branches: [main] env: AWS_REGION: us-east-1 ECR_REPOSITORY_APP: assignmentdocker-dev-ecr-repo ECR_REPOSITORY_MYSQL: assignmentdocker-dev-mysql-ecr-repo + jobs: build-and-push: runs-on: ubuntu-latest @@ -23,7 +24,7 @@ jobs: aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} aws-region: ${{ env.AWS_REGION }} - aws-session-token: ${{ secrets.AWS_SESSION_TOKEN }} + aws-session-token: ${{ secrets.AWS_SESSION_TOKEN }} # Only include if using temporary credentials - name: Login to Amazon ECR id: login-ecr From 6d225b8ebddcca597c3c205bcf6aadf542c5aad4 Mon Sep 17 00:00:00 2001 From: Krishna Khatiwada Date: Mon, 30 Sep 2024 19:06:18 +0000 Subject: [PATCH 19/23] changed terraform code and security group --- terraform/dev/instances/main.tf | 63 ++++++--------------------------- 1 file changed, 10 insertions(+), 53 deletions(-) diff --git a/terraform/dev/instances/main.tf b/terraform/dev/instances/main.tf index 0bf88bc..b40dfa0 100644 --- a/terraform/dev/instances/main.tf +++ b/terraform/dev/instances/main.tf @@ -42,25 +42,6 @@ module "globalvars" { source = "../../modules/globalvars" } -# Reference subnet provisioned by 01-Networking -resource "aws_instance" "my_instance" { - ami = data.aws_ami.latest_amazon_linux.id - instance_type = lookup(var.instance_type, var.env) - key_name = aws_key_pair.my_key.key_name - vpc_security_group_ids = [aws_security_group.my_sg.id] - associate_public_ip_address = false - - lifecycle { - create_before_destroy = true - } - - tags = merge(local.default_tags, - { - "Name" = "${local.name_prefix}-my-instance-Linux" - } - ) -} - # Create two more instances resource "aws_instance" "my_instance_1" { ami = data.aws_ami.latest_amazon_linux.id @@ -80,23 +61,6 @@ resource "aws_instance" "my_instance_1" { ) } -resource "aws_instance" "my_instance_2" { - ami = data.aws_ami.latest_amazon_linux.id - instance_type = lookup(var.instance_type, var.env) - key_name = aws_key_pair.my_key.key_name - vpc_security_group_ids = [aws_security_group.my_sg.id] - associate_public_ip_address = false - - lifecycle { - create_before_destroy = true - } - - tags = merge(local.default_tags, - { - "Name" = "${local.name_prefix}-my-instance-2" - } - ) -} # Adding SSH key to Amazon EC2 resource "aws_key_pair" "my_key" { @@ -118,6 +82,15 @@ resource "aws_security_group" "my_sg" { cidr_blocks = ["0.0.0.0/0"] ipv6_cidr_blocks = ["::/0"] } + + ingress { + description = "Http from everywhere" + from_port = 80 + to_port = 80 + protocol = "tcp" + cidr_blocks = ["0.0.0.0/0"] + ipv6_cidr_blocks = ["::/0"] + } egress { from_port = 0 @@ -134,15 +107,6 @@ resource "aws_security_group" "my_sg" { ) } -# Elastic IP -resource "aws_eip" "static_eip_my_instance" { - instance = aws_instance.my_instance.id - tags = merge(local.default_tags, - { - "Name" = "${local.name_prefix}-eip" - } - ) -} resource "aws_eip" "static_eip_my_instance_1" { instance = aws_instance.my_instance_1.id tags = merge(local.default_tags, @@ -151,14 +115,7 @@ resource "aws_eip" "static_eip_my_instance_1" { } ) } -resource "aws_eip" "static_eip_my_instance_2" { - instance = aws_instance.my_instance_2.id - tags = merge(local.default_tags, - { - "Name" = "${local.name_prefix}-eip" - } - ) -} + # Elastic Container Registry (ECR) - Create a new repository resource "aws_ecr_repository" "my_ecr_repo" { name = lower("${local.name_prefix}-ecr-repo") From 37129bc76c6206f9a2aa6c9780a021fd30eb68c2 Mon Sep 17 00:00:00 2001 From: Krishna Khatiwada Date: Mon, 30 Sep 2024 19:09:15 +0000 Subject: [PATCH 20/23] user data added --- terraform/dev/instances/main.tf | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/terraform/dev/instances/main.tf b/terraform/dev/instances/main.tf index b40dfa0..63d7424 100644 --- a/terraform/dev/instances/main.tf +++ b/terraform/dev/instances/main.tf @@ -59,6 +59,15 @@ resource "aws_instance" "my_instance_1" { "Name" = "${local.name_prefix}-my-instance-1" } ) + user_data = <<-EOF + #!/bin/bash + sudo yum update -y + sudo amazon-linux-extras install docker -y + sudo service docker start + sudo usermod -a -G docker ec2-user + sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose + sudo chmod +x /usr/local/bin/docker-compose + EOF } From f564173e7a79b91f103f4036330f3eb119c474e3 Mon Sep 17 00:00:00 2001 From: Krishna Khatiwada Date: Mon, 30 Sep 2024 21:54:31 +0000 Subject: [PATCH 21/23] security ingress added --- terraform/dev/instances/main.tf | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/terraform/dev/instances/main.tf b/terraform/dev/instances/main.tf index 63d7424..d146469 100644 --- a/terraform/dev/instances/main.tf +++ b/terraform/dev/instances/main.tf @@ -100,6 +100,15 @@ resource "aws_security_group" "my_sg" { cidr_blocks = ["0.0.0.0/0"] ipv6_cidr_blocks = ["::/0"] } + + ingress { + description = "Custom TCP" + from_port = 8081 + to_port = 8083 + protocol = "TCP" + cidr_blocks = ["0.0.0.0/0"] + } + egress { from_port = 0 @@ -126,7 +135,7 @@ resource "aws_eip" "static_eip_my_instance_1" { } # Elastic Container Registry (ECR) - Create a new repository -resource "aws_ecr_repository" "my_ecr_repo" { +resource "aws_ecr_repository" "app_ecr_repo" { name = lower("${local.name_prefix}-ecr-repo") image_tag_mutability = "MUTABLE" tags = merge(local.default_tags, From b0698493bf17da406902a66388796af102f7404e Mon Sep 17 00:00:00 2001 From: Krishna Khatiwada Date: Tue, 1 Oct 2024 01:22:48 +0000 Subject: [PATCH 22/23] this is video purpose only --- terraform/dev/instances/main.tf | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/terraform/dev/instances/main.tf b/terraform/dev/instances/main.tf index d146469..96deb55 100644 --- a/terraform/dev/instances/main.tf +++ b/terraform/dev/instances/main.tf @@ -5,6 +5,8 @@ # #---------------------------------------------------------- +# this is video recording purpose + # Define the provider provider "aws" { region = "us-east-1" @@ -100,7 +102,6 @@ resource "aws_security_group" "my_sg" { cidr_blocks = ["0.0.0.0/0"] ipv6_cidr_blocks = ["::/0"] } - ingress { description = "Custom TCP" from_port = 8081 From e1af3a19c2c9394bd6592ac5b2378d22373585bc Mon Sep 17 00:00:00 2001 From: Krishna Khatiwada Date: Tue, 1 Oct 2024 02:25:02 +0000 Subject: [PATCH 23/23] Demo Purpose --- terraform/dev/instances/main.tf | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/terraform/dev/instances/main.tf b/terraform/dev/instances/main.tf index 96deb55..40b31e6 100644 --- a/terraform/dev/instances/main.tf +++ b/terraform/dev/instances/main.tf @@ -5,8 +5,7 @@ # #---------------------------------------------------------- -# this is video recording purpose - +#this is for video purpose # Define the provider provider "aws" { region = "us-east-1"