Compare commits

13 Commits
main ... devpod

Author SHA1 Message Date
hnaumann
a180c84bfd adding demo feature to devcontainer.json 2025-02-04 12:53:12 +01:00
hnaumann
03d8a7ed99 adding aws sso cli 2025-01-29 13:17:03 +00:00
hnaumann
ef64a68e3b adding aws credentials 2025-01-29 13:59:29 +01:00
hgn
8edfb6efbc .devcontainer/devcontainer.json aktualisiert 2024-11-14 22:19:29 +01:00
hgn
0961783e91 testing new devcontainer.json 2024-11-14 21:44:04 +01:00
hgn
0849f21526 .devcontainer/devcontainer.json aktualisiert 2024-11-14 21:34:26 +01:00
hgn
7009ba474c .devcontainer/devcontainer.json aktualisiert 2024-11-14 21:20:22 +01:00
hnaumann
8b6707ca87 adding version to webserver_sg 2024-10-07 07:20:38 +00:00
hnaumann
417f245564 modified: .gitignore
.terraform.lock.hcl
2024-10-01 14:19:40 +00:00
hnaumann
745f32cb0c removing lines 2024-10-01 14:15:17 +00:00
hnaumann
d8fc001156 removing remote user 2024-09-11 14:23:17 +02:00
hnaumann
fe497c0abb adding features, and commentted options 2024-09-11 14:22:50 +02:00
hnaumann
a5089abd02 adding devcontainer 2024-08-28 09:24:12 +02:00
3 changed files with 51 additions and 11 deletions

View 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"
}

2
.gitignore vendored
View File

@@ -5,7 +5,7 @@
# .tfstate files
*.tfstate
*.tfstate.*
.terraform.locck.hcl
# Crash log files
crash.log
crash.*.log

17
main.tf
View File

@@ -1,5 +1,5 @@
provider "aws" {
region = local.region
region = local.region
}
locals {
@@ -9,13 +9,11 @@ locals {
### create a 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"
create_private_key = true
}
### create a vpc
module "vpc" {
source = "terraform-aws-modules/vpc/aws"
@@ -43,27 +41,26 @@ module "vpc" {
### create a security group
module "web_server_sg" {
version = "5.2.0"
source = "terraform-aws-modules/security-group/aws//modules/http-80"
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
ingress_cidr_blocks = ["0.0.0.0/0"]
ingress_rules = ["http-80-tcp", "https-443-tcp", "ssh-tcp"]
}
### create an ec2 instance
module "ec2_instance" {
source = "terraform-aws-modules/ec2-instance/aws"
name = "${local.name}-web-server"
name = "${local.name}-web-server"
instance_type = "t2.micro"
key_name = module.key_pair.key_pair_name
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]
user_data = file("userdata.sh")
user_data = file("userdata.sh")
tags = {
Terraform = "true"