adding devcontainer
This commit is contained in:
33
.devcontainer/devcontainer.json
Normal file
33
.devcontainer/devcontainer.json
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
// 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": "terrafrom-dev-test",
|
||||||
|
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
|
||||||
|
"image": "mcr.microsoft.com/devcontainers/base:jammy",
|
||||||
|
|
||||||
|
// Features to add to the dev container. More info: https://containers.dev/features.
|
||||||
|
"features": {
|
||||||
|
"ghcr.io/devcontainers/features/terraform:1": {},
|
||||||
|
"ghcr.io/dhoeric/features/tfsec:1":{},
|
||||||
|
},
|
||||||
|
|
||||||
|
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
||||||
|
// "forwardPorts": [],
|
||||||
|
|
||||||
|
// Use 'postCreateCommand' to run commands after the container is created.
|
||||||
|
"postCreateCommand": "echo 'use tfsec and tflint for better results'",
|
||||||
|
|
||||||
|
// Configure tool-specific properties.
|
||||||
|
"customizations": {
|
||||||
|
"vscode": {
|
||||||
|
"extensions": [
|
||||||
|
"hashicorp.terraform",
|
||||||
|
"gitlens.gitlens"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
|
||||||
|
// "remoteUser": "root"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
4
main.tf
4
main.tf
@@ -10,12 +10,10 @@ 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"
|
||||||
@@ -51,8 +49,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