{"id":19143175,"url":"https://github.com/devenes/terraform-cloudformation-github-actions-vpc-ec2","last_synced_at":"2026-04-13T03:33:59.448Z","repository":{"id":107131446,"uuid":"488017083","full_name":"devenes/terraform-cloudformation-github-actions-vpc-ec2","owner":"devenes","description":"Deploying new Security Group, VPC with a public subnet and a single EC2 instance in AWS CloudFormation Stack using Terraform and Github Actions","archived":false,"fork":false,"pushed_at":"2022-05-03T00:41:55.000Z","size":315,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-07-14T12:41:25.305Z","etag":null,"topics":["cloud-formation","cloudformation","cloudformation-stack","ec2","github-actions","infrastructure","json","terraform","vpc","yaml"],"latest_commit_sha":null,"homepage":"","language":"HCL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/devenes.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-05-02T23:10:15.000Z","updated_at":"2022-05-04T23:09:09.000Z","dependencies_parsed_at":null,"dependency_job_id":"dc89d441-8ad9-4389-836d-d433e73425a2","html_url":"https://github.com/devenes/terraform-cloudformation-github-actions-vpc-ec2","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/devenes/terraform-cloudformation-github-actions-vpc-ec2","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devenes%2Fterraform-cloudformation-github-actions-vpc-ec2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devenes%2Fterraform-cloudformation-github-actions-vpc-ec2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devenes%2Fterraform-cloudformation-github-actions-vpc-ec2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devenes%2Fterraform-cloudformation-github-actions-vpc-ec2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devenes","download_url":"https://codeload.github.com/devenes/terraform-cloudformation-github-actions-vpc-ec2/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devenes%2Fterraform-cloudformation-github-actions-vpc-ec2/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279010515,"owners_count":26084757,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-12T02:00:06.719Z","response_time":53,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cloud-formation","cloudformation","cloudformation-stack","ec2","github-actions","infrastructure","json","terraform","vpc","yaml"],"created_at":"2024-11-09T07:29:52.336Z","updated_at":"2025-10-12T06:36:28.538Z","avatar_url":"https://github.com/devenes.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Terraform Infrastructure Apply](https://github.com/devenes/terraform-cloudformation-github-actions-vpc-ec2/actions/workflows/tf_apply.yml/badge.svg)](https://github.com/devenes/terraform-cloudformation-github-actions-vpc-ec2/actions/workflows/tf_apply.yml) [![Terraform Infrastructure Plan](https://github.com/devenes/terraform-cloudformation-github-actions-vpc-ec2/actions/workflows/tf_plan.yml/badge.svg)](https://github.com/devenes/terraform-cloudformation-github-actions-vpc-ec2/actions/workflows/tf_plan.yml) [![Terraform Infrastructure Destroy](https://github.com/devenes/terraform-cloudformation-github-actions-vpc-ec2/actions/workflows/tf_destroy.yml/badge.svg)](https://github.com/devenes/terraform-cloudformation-github-actions-vpc-ec2/actions/workflows/tf_destroy.yml)\n\n# Automated Infrastructure Deployment with AWS CloudFormation, Terraform and Github Actions\n\nDeploying new Security Group, VPC with a public subnet and a single EC2 instance in AWS CloudFormation Stack using Terraform and Github Actions.\n\n## Project Architecture\n\n![Project](project.jpg)\n\n## AWS CloudFormation Stack Events\n\n![AWS CloudFormation Stack](events.png)\n\n## AWS CloudFormation Stack Resources\n\n![AWS CloudFormation Stack](resources.png)\n\n## AWS CloudFormation\n\nAWS CloudFormation enables you to create and provision AWS infrastructure deployments predictably and repeatedly. It helps you leverage AWS products such as Amazon EC2, Amazon Elastic Block Store, Amazon SNS, Elastic Load Balancing, and Auto Scaling to build highly reliable, highly scalable, cost-effective applications in the cloud without worrying about creating and configuring the underlying AWS infrastructure. AWS CloudFormation enables you to use a template file to create and delete a collection of resources together as a single unit (a stack).\n\n## CloudFormation JSON Template File\n\n```json\n{\n  \"AWSTemplateFormatVersion\": \"2010-09-09\",\n  \"Description\": \"This AWS CloudFormation template creates a new Security Group,\\nVPC with a public subnet and a single EC2 instance.\\n\",\n  \"Parameters\": {\n    \"VpcCidr\": {\n      \"Default\": \"172.16.0.0/16\",\n      \"Description\": \"CIDR block for the VPC. Default is 10.0.0.0/16\",\n      \"Type\": \"String\"\n    },\n    \"KeyName\": {\n      \"Description\": \"The EC2 Key Pair to allow SSH access to the instance\",\n      \"Type\": \"AWS::EC2::KeyPair::KeyName\",\n      \"Default\": \"east1\"\n    },\n    \"PublicSubnet\": {\n      \"Default\": \"172.16.10.10/24\",\n      \"Description\": \"CIDR block for the subnet.\",\n      \"Type\": \"String\"\n    },\n    \"InstanceType\": {\n      \"Description\": \"WebServer EC2 instance type\",\n      \"Type\": \"String\",\n      \"Default\": \"t2.micro\"\n    }\n  },\n  \"Resources\": {\n    \"Vpc\": {\n      \"Properties\": {\n        \"CidrBlock\": {\n          \"Ref\": \"VpcCidr\"\n        },\n        \"Tags\": [\n          {\n            \"Key\": \"Name\",\n            \"Value\": \"terraform-vpc\"\n          }\n        ]\n      },\n      \"Type\": \"AWS::EC2::VPC\"\n    },\n    \"PublicSecurityGroup\": {\n      \"Type\": \"AWS::EC2::SecurityGroup\",\n      \"Properties\": {\n        \"GroupName\": \"EC2 Security Group\",\n        \"GroupDescription\": \"Enable SSH access via port 22\",\n        \"VpcId\": {\n          \"Ref\": \"Vpc\"\n        },\n        \"SecurityGroupIngress\": [\n          {\n            \"IpProtocol\": \"tcp\",\n            \"FromPort\": 80,\n            \"ToPort\": 80,\n            \"CidrIp\": \"0.0.0.0/0\"\n          },\n          {\n            \"IpProtocol\": \"tcp\",\n            \"FromPort\": 22,\n            \"ToPort\": 22,\n            \"CidrIp\": \"0.0.0.0/0\"\n          },\n          {\n            \"IpProtocol\": \"tcp\",\n            \"FromPort\": 443,\n            \"ToPort\": 443,\n            \"CidrIp\": \"0.0.0.0/0\"\n          }\n        ],\n        \"SecurityGroupEgress\": [\n          {\n            \"IpProtocol\": \"tcp\",\n            \"FromPort\": 80,\n            \"ToPort\": 80,\n            \"CidrIp\": \"0.0.0.0/0\"\n          }\n        ],\n        \"Tags\": [\n          {\n            \"Key\": \"Name\",\n            \"Value\": \"terraform-security-group\"\n          }\n        ]\n      }\n    },\n    \"EC2PublicSubnet\": {\n      \"Properties\": {\n        \"CidrBlock\": {\n          \"Ref\": \"PublicSubnet\"\n        },\n        \"VpcId\": {\n          \"Ref\": \"Vpc\"\n        },\n        \"Tags\": [\n          {\n            \"Key\": \"Name\",\n            \"Value\": \"terraform-public-subnet\"\n          }\n        ]\n      },\n      \"Type\": \"AWS::EC2::Subnet\"\n    },\n    \"Instance\": {\n      \"Type\": \"AWS::EC2::Instance\",\n      \"Properties\": {\n        \"ImageId\": \"ami-00a9d4a05375b2763\",\n        \"InstanceType\": {\n          \"Ref\": \"InstanceType\"\n        },\n        \"KeyName\": {\n          \"Ref\": \"KeyName\"\n        },\n        \"SubnetId\": {\n          \"Ref\": \"EC2PublicSubnet\"\n        },\n        \"SecurityGroupIds\": [\n          {\n            \"Ref\": \"PublicSecurityGroup\"\n          }\n        ],\n        \"Tags\": [\n          {\n            \"Key\": \"Name\",\n            \"Value\": \"Terraform Instance\"\n          }\n        ]\n      }\n    }\n  }\n}\n```\n\n## CloudFormation YAML Template File\n\n```yaml\nAWSTemplateFormatVersion: 2010-09-09\nDescription: |\n  This AWS CloudFormation template creates a new Security Group, \n  VPC with a public subnet and a single EC2 instance.\n\nParameters:\n  VpcCidr:\n    Default: 172.16.0.0/16\n    Description: CIDR block for the VPC. Default is 10.0.0.0/16\n    Type: String\n\n  KeyName:\n    Description: The EC2 Key Pair to allow SSH access to the instance\n    Type: \"AWS::EC2::KeyPair::KeyName\"\n    Default: east1\n\n  PublicSubnet:\n    Default: 172.16.10.10/24\n    Description: CIDR block for the subnet.\n    Type: String\n\n  InstanceType:\n    Description: WebServer EC2 instance type\n    Type: String\n    Default: t2.micro\n\nResources:\n  Vpc:\n    Properties:\n      CidrBlock: !Ref VpcCidr\n      Tags:\n        - Key: Name\n          Value: terraform-vpc\n    Type: \"AWS::EC2::VPC\"\n\n  PublicSecurityGroup:\n    Type: \"AWS::EC2::SecurityGroup\"\n    Properties:\n      GroupName: EC2 Security Group\n      GroupDescription: Enable SSH access via port 22\n      VpcId: !Ref Vpc\n      SecurityGroupIngress:\n        - IpProtocol: tcp\n          FromPort: 80\n          ToPort: 80\n          CidrIp: 0.0.0.0/0\n        - IpProtocol: tcp\n          FromPort: 22\n          ToPort: 22\n          CidrIp: 0.0.0.0/0\n        - IpProtocol: tcp\n          FromPort: 443\n          ToPort: 443\n          CidrIp: 0.0.0.0/0\n      SecurityGroupEgress:\n        - IpProtocol: tcp\n          FromPort: 80\n          ToPort: 80\n          CidrIp: 0.0.0.0/0\n      Tags:\n        - Key: Name\n          Value: terraform-security-group\n\n  EC2PublicSubnet:\n    Properties:\n      CidrBlock: !Ref PublicSubnet\n      VpcId: !Ref Vpc\n      Tags:\n        - Key: Name\n          Value: terraform-public-subnet\n    Type: \"AWS::EC2::Subnet\"\n\n  Instance:\n    Type: \"AWS::EC2::Instance\"\n    Properties:\n      ImageId: ami-00a9d4a05375b2763\n      InstanceType: !Ref InstanceType\n      KeyName: !Ref KeyName\n      SubnetId: !Ref EC2PublicSubnet\n      SecurityGroupIds:\n        - !Ref PublicSecurityGroup\n      Tags:\n        - Key: Name\n          Value: Terraform Instance\n```\n\n## Documentation Resources\n\n[Terraform CloudFormation](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudformation_stack)\n\n[AWS CloudFormation](https://docs.aws.amazon.com/cloudformation/index.html)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevenes%2Fterraform-cloudformation-github-actions-vpc-ec2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevenes%2Fterraform-cloudformation-github-actions-vpc-ec2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevenes%2Fterraform-cloudformation-github-actions-vpc-ec2/lists"}