Compare commits
17 Commits
devpod
...
05ab1ed606
Author | SHA1 | Date | |
---|---|---|---|
![]() |
05ab1ed606 | ||
![]() |
5cf3e87c55 | ||
![]() |
e906fa54a9 | ||
![]() |
c25f858d89 | ||
![]() |
187525f3ed | ||
![]() |
a89000a6cc | ||
![]() |
14b733d7b8 | ||
![]() |
06bef64e87 | ||
![]() |
777e4b2b1c | ||
![]() |
71c7f27be3 | ||
![]() |
ca47b2da90 | ||
![]() |
d6bb82d059 | ||
![]() |
8201d901f3 | ||
![]() |
4e3e6caad7 | ||
![]() |
9a0e818403 | ||
![]() |
5330238c7b | ||
![]() |
acdb55b0f8 |
17
.github/workflows/codescanning.yaml
vendored
Normal file
17
.github/workflows/codescanning.yaml
vendored
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
name: build
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
- devpod
|
||||||
|
pull_request:
|
||||||
|
jobs:
|
||||||
|
tfsec:
|
||||||
|
name: tfsec
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Clone repo
|
||||||
|
uses: actions/checkout@master
|
||||||
|
- name: tfsec
|
||||||
|
uses: aquasecurity/tfsec-action@v1.0.0
|
18
.github/workflows/test.yaml
vendored
Normal file
18
.github/workflows/test.yaml
vendored
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
name: stack test
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
- devpod
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: test terraform
|
||||||
|
uses: "infinite-automations/terraform-all-in-one@v1"
|
||||||
|
with:
|
||||||
|
plan: false
|
||||||
|
test: true
|
||||||
|
directory: "./terraform"
|
||||||
|
test-directory: "./terraform"
|
7
.vscode/settings.json
vendored
Normal file
7
.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"editor.formatOnSave": true,
|
||||||
|
"files.trimTrailingWhitespace": false,
|
||||||
|
"files.insertFinalNewline": true,
|
||||||
|
"terraform.experimentalFeatures.validateOnSave": true,
|
||||||
|
"editor.tabSize": 2
|
||||||
|
}
|
@@ -1,5 +1,5 @@
|
|||||||
provider "aws" {
|
provider "aws" {
|
||||||
region = local.region
|
region = local.region
|
||||||
}
|
}
|
||||||
|
|
||||||
locals {
|
locals {
|
||||||
@@ -28,12 +28,15 @@ module "vpc" {
|
|||||||
private_subnets = ["10.0.1.0/24", "10.0.2.0/24", "10.0.3.0/24"]
|
private_subnets = ["10.0.1.0/24", "10.0.2.0/24", "10.0.3.0/24"]
|
||||||
public_subnets = ["10.0.101.0/24", "10.0.102.0/24", "10.0.103.0/24"]
|
public_subnets = ["10.0.101.0/24", "10.0.102.0/24", "10.0.103.0/24"]
|
||||||
|
|
||||||
|
|
||||||
enable_nat_gateway = true
|
enable_nat_gateway = true
|
||||||
single_nat_gateway = true
|
single_nat_gateway = true
|
||||||
|
|
||||||
enable_dns_hostnames = true
|
enable_dns_hostnames = true
|
||||||
enable_dns_support = true
|
enable_dns_support = true
|
||||||
|
|
||||||
|
enable_flow_log = true
|
||||||
|
|
||||||
tags = {
|
tags = {
|
||||||
terraform = "true"
|
terraform = "true"
|
||||||
environment = "test"
|
environment = "test"
|
||||||
@@ -45,7 +48,7 @@ module "vpc" {
|
|||||||
module "web_server_sg" {
|
module "web_server_sg" {
|
||||||
source = "terraform-aws-modules/security-group/aws//modules/http-80"
|
source = "terraform-aws-modules/security-group/aws//modules/http-80"
|
||||||
name = "${local.name}-web-server-sg"
|
name = "${local.name}-web-server-sg"
|
||||||
description = "Security group for web server of ${local.name}"
|
description = "Security group for web server of ${local.name}"
|
||||||
vpc_id = module.vpc.vpc_id
|
vpc_id = module.vpc.vpc_id
|
||||||
ingress_cidr_blocks = ["0.0.0.0/0"]
|
ingress_cidr_blocks = ["0.0.0.0/0"]
|
||||||
ingress_rules = ["http-80-tcp", "https-443-tcp", "ssh-tcp"]
|
ingress_rules = ["http-80-tcp", "https-443-tcp", "ssh-tcp"]
|
||||||
@@ -56,14 +59,14 @@ module "web_server_sg" {
|
|||||||
### create an ec2 instance
|
### create an ec2 instance
|
||||||
module "ec2_instance" {
|
module "ec2_instance" {
|
||||||
source = "terraform-aws-modules/ec2-instance/aws"
|
source = "terraform-aws-modules/ec2-instance/aws"
|
||||||
name = "${local.name}-web-server"
|
name = "${local.name}-web-server"
|
||||||
|
|
||||||
instance_type = "t2.micro"
|
instance_type = "t2.micro"
|
||||||
key_name = module.key_pair.key_pair_name
|
key_name = module.key_pair.key_pair_name
|
||||||
monitoring = true
|
monitoring = true
|
||||||
vpc_security_group_ids = [ module.web_server_sg.security_group_id ]
|
vpc_security_group_ids = [module.web_server_sg.security_group_id]
|
||||||
subnet_id = module.vpc.public_subnets[0]
|
subnet_id = module.vpc.public_subnets[0]
|
||||||
user_data = file("userdata.sh")
|
user_data = file("userdata.sh")
|
||||||
|
|
||||||
tags = {
|
tags = {
|
||||||
Terraform = "true"
|
Terraform = "true"
|
Reference in New Issue
Block a user