Compare commits
13 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
a180c84bfd | ||
![]() |
03d8a7ed99 | ||
![]() |
ef64a68e3b | ||
![]() |
8edfb6efbc | ||
![]() |
0961783e91 | ||
![]() |
0849f21526 | ||
![]() |
7009ba474c | ||
![]() |
8b6707ca87 | ||
![]() |
417f245564 | ||
![]() |
745f32cb0c | ||
![]() |
d8fc001156 | ||
![]() |
fe497c0abb | ||
![]() |
a5089abd02 |
43
.devcontainer/devcontainer.json
Normal file
43
.devcontainer/devcontainer.json
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
|
||||||
|
// README at: https://github.com/devcontainers/templates/tree/main/src/ubuntu
|
||||||
|
{
|
||||||
|
"name": "terraform-dev-environment",
|
||||||
|
"image": "mcr.microsoft.com/devcontainers/base:jammy",
|
||||||
|
"features": {
|
||||||
|
"ghcr.io/devcontainers/features/terraform:1": {},
|
||||||
|
"ghcr.io/dhoeric/features/terraform-docs:1": {},
|
||||||
|
//"ghcr.io/devcontainers-extra/features/kind:1": {},
|
||||||
|
"ghcr.io/dhoeric/features/tfsec:1": {}
|
||||||
|
},
|
||||||
|
// mounting local aws configuration
|
||||||
|
"mounts": [
|
||||||
|
"source=${env:HOME}${env:USERPROFILE}/.aws,target=/home/vscode/.aws,type=bind"
|
||||||
|
],
|
||||||
|
// a post create command to check the installed versions
|
||||||
|
"postCreateCommand": "terraform version && tfsec --version && terraform-docs --version",
|
||||||
|
// setting the default vsc addons and settings
|
||||||
|
"customizations": {
|
||||||
|
"vscode": {
|
||||||
|
"extensions": [
|
||||||
|
"hashicorp.terraform",
|
||||||
|
"tfsec.tfsec",
|
||||||
|
"oderwat.indent-rainbow",
|
||||||
|
"catppuccin.catppuccin-vsc",
|
||||||
|
"catppuccin.catppuccin-vsc-icons",
|
||||||
|
"continue.continue"
|
||||||
|
],
|
||||||
|
"settings": {
|
||||||
|
"editor.formatOnSave": true,
|
||||||
|
"editor.trimTrailingWhitespace": true,
|
||||||
|
"files.trimTrailingWhitespace": true,
|
||||||
|
"files.insertFinalNewline": true,
|
||||||
|
"terraform.experimentalFeatures.validateOnSave": true,
|
||||||
|
"terraform.languageServer": {
|
||||||
|
"enabled": true,
|
||||||
|
"args": []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"remoteUser": "vscode"
|
||||||
|
}
|
18
.github/workflows/test.yaml
vendored
18
.github/workflows/test.yaml
vendored
@@ -1,18 +0,0 @@
|
|||||||
name: 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"
|
|
2
.gitignore
vendored
2
.gitignore
vendored
@@ -5,7 +5,7 @@
|
|||||||
# .tfstate files
|
# .tfstate files
|
||||||
*.tfstate
|
*.tfstate
|
||||||
*.tfstate.*
|
*.tfstate.*
|
||||||
|
.terraform.locck.hcl
|
||||||
# Crash log files
|
# Crash log files
|
||||||
crash.log
|
crash.log
|
||||||
crash.*.log
|
crash.*.log
|
||||||
|
@@ -9,13 +9,11 @@ locals {
|
|||||||
|
|
||||||
### create a key pair
|
### create a key pair
|
||||||
module "key_pair" {
|
module "key_pair" {
|
||||||
source = "terraform-aws-modules/key-pair/aws"
|
source = "terraform-aws-modules/key-pair/aws"
|
||||||
|
|
||||||
key_name = "${local.name}-test-key"
|
key_name = "${local.name}-test-key"
|
||||||
create_private_key = true
|
create_private_key = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
### create a vpc
|
### create a vpc
|
||||||
module "vpc" {
|
module "vpc" {
|
||||||
source = "terraform-aws-modules/vpc/aws"
|
source = "terraform-aws-modules/vpc/aws"
|
||||||
@@ -28,15 +26,12 @@ 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"
|
||||||
@@ -46,6 +41,7 @@ module "vpc" {
|
|||||||
|
|
||||||
### create a security group
|
### create a security group
|
||||||
module "web_server_sg" {
|
module "web_server_sg" {
|
||||||
|
version = "5.2.0"
|
||||||
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}"
|
||||||
@@ -54,8 +50,6 @@ module "web_server_sg" {
|
|||||||
ingress_rules = ["http-80-tcp", "https-443-tcp", "ssh-tcp"]
|
ingress_rules = ["http-80-tcp", "https-443-tcp", "ssh-tcp"]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### 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"
|
Reference in New Issue
Block a user