mirror of
https://github.com/MichaelCade/90DaysOfDevOps.git
synced 2025-07-30 06:41:43 +07:00
add new tests for IaC codebase
This commit is contained in:
12
2022/Days/IaC/Terratest/examples/instance.tf
Normal file
12
2022/Days/IaC/Terratest/examples/instance.tf
Normal file
@ -0,0 +1,12 @@
|
||||
resource "aws_instance" "example" {
|
||||
ami = var.AMIS[var.AWS_REGION]
|
||||
instance_type = "t2.micro"
|
||||
vpc_security_group_ids = [aws_security_group.instance.id]
|
||||
|
||||
# When the instance boots, start a web server on port 8080 that responds with "Hello, World!".
|
||||
user_data = <<EOF
|
||||
#!/bin/bash
|
||||
echo "Hello, World!" > index.html
|
||||
nohup busybox httpd -f -p 8080 &
|
||||
EOF
|
||||
}
|
4
2022/Days/IaC/Terratest/examples/output.tf
Normal file
4
2022/Days/IaC/Terratest/examples/output.tf
Normal file
@ -0,0 +1,4 @@
|
||||
# Output the instance's public IP address.
|
||||
output "public_ip" {
|
||||
value = aws_instance.example.public_ip
|
||||
}
|
5
2022/Days/IaC/Terratest/examples/provider.tf
Normal file
5
2022/Days/IaC/Terratest/examples/provider.tf
Normal file
@ -0,0 +1,5 @@
|
||||
provider "aws" {
|
||||
access_key = var.AWS_ACCESS_KEY
|
||||
secret_key = var.AWS_SECRET_KEY
|
||||
region = var.AWS_REGION
|
||||
}
|
9
2022/Days/IaC/Terratest/examples/securitygroup.tf
Normal file
9
2022/Days/IaC/Terratest/examples/securitygroup.tf
Normal file
@ -0,0 +1,9 @@
|
||||
# Allow the instance to receive requests on port 8080.
|
||||
resource "aws_security_group" "instance" {
|
||||
ingress {
|
||||
from_port = 8080
|
||||
to_port = 8080
|
||||
protocol = "tcp"
|
||||
cidr_blocks = ["0.0.0.0/0"]
|
||||
}
|
||||
}
|
3
2022/Days/IaC/Terratest/examples/terraform.tfvars
Normal file
3
2022/Days/IaC/Terratest/examples/terraform.tfvars
Normal file
@ -0,0 +1,3 @@
|
||||
AWS_ACCESS_KEY = "XXXX"
|
||||
AWS_SECRET_KEY = "XXXXXXXX"
|
||||
AWS_REGION="ap-south-1"
|
16
2022/Days/IaC/Terratest/examples/vars.tf
Normal file
16
2022/Days/IaC/Terratest/examples/vars.tf
Normal file
@ -0,0 +1,16 @@
|
||||
variable "AWS_ACCESS_KEY" {
|
||||
}
|
||||
|
||||
variable "AWS_SECRET_KEY" {
|
||||
}
|
||||
|
||||
variable "AWS_REGION" {
|
||||
default = "ap-south-1"
|
||||
}
|
||||
|
||||
variable "AMIS" {
|
||||
type = map(string)
|
||||
default = {
|
||||
ap-south-1 = "ami-0860c9429baba6ad2"
|
||||
}
|
||||
}
|
3
2022/Days/IaC/Terratest/examples/versions.tf
Normal file
3
2022/Days/IaC/Terratest/examples/versions.tf
Normal file
@ -0,0 +1,3 @@
|
||||
terraform {
|
||||
required_version = ">= 0.12.26"
|
||||
}
|
Reference in New Issue
Block a user