Skip to content

Commit

Permalink
🧹 A few additions to the AMI (#57)
Browse files Browse the repository at this point in the history
* git reset --soft $(git merge-base main HEAD)

Signed-off-by: Manuel Weber <[email protected]>

* add to Readme.md

Signed-off-by: Manuel Weber <[email protected]>

---------

Signed-off-by: Manuel Weber <[email protected]>
  • Loading branch information
mm-weber authored Jun 4, 2024
1 parent feff43d commit b2c7284
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 0 deletions.
1 change: 1 addition & 0 deletions aws/ec2-instances/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ This repository contains Terraform code for provisioning AWS EC2 instances for t
| Windows 2022 CIS cnspec | CIS Microsoft Windows Server 2022 Benchmark - Level 2 with latest cnspec | `create_windows2022_cis_cnspec` | [CIS Microsoft Windows Server 2022 Benchmark - Level 2](https://aws.amazon.com/marketplace/pp/prodview-lhbxwzmvsawbw?sr=0-19&ref_=beagle&applicationId=AWSMPContessa) |
| Windows 2022 German | Latest Windows 2022 Server German | `create_windows2022_german` | N/A |
| Windows 2022 Italian | Latest Windows 2022 Server Italian | `create_windows2022_italian` | N/A |
| NGINX on Windows 2016 Server | NGINX on Windows 2016 Server | `create_nginx_win2016_cnspec` | N/A |

## Provision

Expand Down
17 changes: 17 additions & 0 deletions aws/ec2-instances/amis.tf
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,23 @@ data "aws_ami" "nginx_rhel9_cis" {
owners = ["679593333241"]
}

data "aws_ami" "nginx_win2016" {
most_recent = true

filter {
name = "name"
values = ["NGINX2016-*"]
}

filter {
name = "virtualization-type"
values = ["hvm"]
}

owners = ["679593333241"]
}



data "aws_ami" "rhel9" {
most_recent = true
Expand Down
15 changes: 15 additions & 0 deletions aws/ec2-instances/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -579,8 +579,23 @@ module "nginx_rhel9_cis_cnspec" {
user_data_replace_on_change = true
}

// NGINX on Windows 2016

module "nginx_win2016_cnspec" {
source = "terraform-aws-modules/ec2-instance/aws"
version = "~> 5.2.1"

create = var.create_nginx_win2016_cnspec
name = "${var.prefix}-nginx-win2016-cnspec-${random_id.instance_id.id}"
ami = data.aws_ami.nginx_win2016.id
instance_type = var.windows_instance_type
vpc_security_group_ids = [module.windows_sg.security_group_id]
subnet_id = module.vpc.public_subnets[0]
key_name = var.aws_key_pair_name
associate_public_ip_address = true
user_data = base64encode(local.windows_user_data_cnspec)
user_data_replace_on_change = true
}

// Ubuntu2004

Expand Down
4 changes: 4 additions & 0 deletions aws/ec2-instances/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -256,4 +256,8 @@ output "windows2022_german" {

output "windows2022_italian" {
value = module.windows2022_italian.public_ip == null ? "" : "xfreerdp /u:Administrator /v:${module.windows2022_italian.public_ip}:3389 /h:2048 /w:2048 /p:'${var.windows_admin_password}'"
}
# nginx on windows 2016
output "nginx_win2016_cnspec" {
value = module.nginx_win2016_cnspec.public_ip == null ? "" : "xfreerdp /u:Administrator /v:${module.nginx_win2016_cnspec.public_ip}:3389 /h:1200 /w:1920 /p:'${var.windows_admin_password}'\n(This will take a couple minutes to become available...)"
}
5 changes: 5 additions & 0 deletions aws/ec2-instances/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,11 @@ variable "create_windows2016_cis_cnspec" {
default = false
}

variable "create_nginx_win2016_cnspec" {
default = false
}


variable "windows_admin_password" {
default = "MondooSPM1!"
}
Expand Down

0 comments on commit b2c7284

Please sign in to comment.