/terraform-aws-nocode-webserver

Terraform no-code enabled module for a web server in AWS

Primary LanguageHCLMIT LicenseMIT

Terraform module aws-nocode-webserver

Provisions an AWS VPC containing an EC2 webserver with a sample HashiCafe website, using a base AMI registered in HCP Packer.

Enabled for Terraform Cloud no-code provisioning.

Prerequisites

For no-code provisioning, AWS credentials must be supplied to the workspace via environment variables (e.g. AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY) or using dynamic provider credentials.

Also requires environment variables containing an HCP service principal credential (HCP_CLIENT_ID and HCP_CLIENT_SECRET). It is recommende to attach these globally or to projects where no-code workspaces will be provisioned.

Requirements

Name Version
terraform >= 1.2
aws ~> 5.0
hcp ~> 0.82
null ~> 3.1
random ~> 3.4
tls ~> 4.0

Providers

Name Version
aws ~> 5.0
hcp ~> 0.82
null ~> 3.1
random ~> 3.4
tls ~> 4.0

Modules

No modules.

Resources

Name Type
aws_eip.hashicafe resource
aws_eip_association.hashicafe resource
aws_instance.hashicafe resource
aws_internet_gateway.hashicafe resource
aws_key_pair.hashicafe resource
aws_route_table.hashicafe resource
aws_route_table_association.hashicafe resource
aws_security_group.hashicafe resource
aws_subnet.hashicafe resource
aws_vpc.hashicafe resource
null_resource.configure-web-app resource
random_integer.product resource
tls_private_key.hashicafe resource
hcp_packer_artifact.ubuntu-webserver data source

Inputs

Name Description Type Default Required
address_space The address space that is used by the virtual network. You can supply more than one address space. Changing this forces a new resource to be created. string "10.0.0.0/16" no
department Value for the department tag. string "WebDev" no
env Value for the environment tag. string n/a yes
hashi_products n/a
list(object({
name = string
color = string
image_file = string
}))
[
{
"color": "#dc477d",
"image_file": "hashicafe_art_consul.png",
"name": "Consul"
},
{
"color": "#ffffff",
"image_file": "hashicafe_art_hcp.png",
"name": "HCP"
},
{
"color": "#60dea9",
"image_file": "hashicafe_art_nomad.png",
"name": "Nomad"
},
{
"color": "#63d0ff",
"image_file": "hashicafe_art_packer.png",
"name": "Packer"
},
{
"color": "#844fba",
"image_file": "hashicafe_art_terraform.png",
"name": "Terraform"
},
{
"color": "#2e71e5",
"image_file": "hashicafe_art_vagrant.png",
"name": "Vagrant"
},
{
"color": "#ffec6e",
"image_file": "hashicafe_art_vault.png",
"name": "Vault"
}
]
no
instance_type Specifies the AWS instance type. string "t3.micro" no
packer_bucket HCP Packer bucket name containing the source image. string "ubuntu22-nginx" no
packer_channel HCP Packer image channel. string "production" no
prefix This prefix will be included in the name of most resources. string n/a yes
region The region where the resources are created. string n/a yes
subnet_prefix The address prefix to use for the subnet. string "10.0.10.0/24" no

Outputs

Name Description
ami_id n/a
app_url n/a
product The product which was randomly selected.