Table of Contents

May 13, 2024 ยท View on GitHub

Maintained Terraform License: MIT

Table of Contents


Introduction

This is a template for Terraform modules.

It is part of our XOAP Automation Forces Open Source community library to give you a quick start into Infrastructure as Code deployments with Terraform.

We have a lot of Terraform modules that are Open Source and maintained by the XOAP staff.

Please check the links for more info, including usage information and full documentation:


Guidelines

We are using the following guidelines to write code and make it easier for everyone to follow a destinctive guideline. Please check these links before starting to work on changes.

Contributor Covenant

Git Naming Conventions are an important part of the development process. They descrtibe how Branched, Commit Messages, Pull Requests and Tags should look like to make the easily understandebla for everybody in the development chain.

Git Naming Conventions

he Conventional Commits specification is a lightweight convention on top of commit messages. It provides an easy set of rules for creating an explicit commit history; which makes it easier to write automated tools on top of.

Conventional Commits

The better a Pull Request description is, the better a review can understand and decide on how to review the changes. This improves implementation speed and reduces communication between the requester and the reviewer resulting in much less overhead.

Wiriting A Great Pull Request Description

Versioning is a crucial part for Terraform Stacks and Modules. Without version tags you cannot clearly create a stable environment and be sure that your latest changes won't crash your production environment (sure it still can happen, but we are trying our best to implement everything that we can to reduce the risk)

Semantic Versioning

Naming Conventions for Terraform resources must be used.

Terraform Naming Conventions


Usage

Installation

For the first ime using this template necessary tools need to be installed. A script for PowerShell Core is provided under ./build/init.ps1

This script will install following dependencies:

This script configures:

  • global git template under ~/.git-template
  • global pre-commit hooks for prepare-commit-msg and commit-msg under ~/.git-template/hooks
  • github actions:
    • linting and checks for pull requests from dev to master/main
    • automatic tagging and release creation on pushes to master/main
    • dependabot updates

It currently supports the automated installation for macOS. Support for Windows and Linux will be available soon.

Synchronisation

We provided a script under ./build/sync_template.ps1 to fetch the latest changes from this template repository. Please be aware that this is mainly a copy operation which means all your current changes have to be committed first and after running the script you have to merge this changes into your codebase.

Configuration


Requirements

NameVersion
terraform>=1.1.6
aws>= 4.8.0

Providers

NameVersion
aws>= 4.8.0

Modules

NameSourceVersion
sg_endpointsgit::github.com/xoap-io/terraform-aws-compute-security-group.gitn/a
this_labelgit::github.com/xoap-io/terraform-aws-misc-labelv0.1.1
this_subnets./modules/subnetn/a

Resources

NameType
aws_default_security_group.thisresource
aws_ec2_transit_gateway_vpc_attachment.thisresource
aws_eip.thisresource
aws_internet_gateway.thisresource
aws_nat_gateway.thisresource
aws_ram_principal_association.thisresource
aws_ram_resource_association.thisresource
aws_ram_resource_share.thisresource
aws_route.igwresource
aws_route.natresource
aws_vpc.thisresource
aws_vpc_dhcp_options.thisresource
aws_vpc_dhcp_options_association.thisresource
aws_vpc_endpoint.dynamodbresource
aws_vpc_endpoint.s3resource
aws_vpc_endpoint.thisresource
aws_organizations_organization.thisdata source
aws_region.thisdata source

Inputs

NameDescriptionTypeDefaultRequired
configConfiguration parameters for the vpc. Per default the vpc is provisioned with the subnet cidr 10.10.0.0.0/16 and full dns support
object({
cidr = string
dns_support = bool
ipv6_support = bool
enable_nat_gateway = bool
nat_gateway_subnet = string
})
{
"cidr": "10.10.0.0/16",
"classic_link_support": false,
"dns_support": true,
"enable_nat_gateway": true,
"ipv6_support": false,
"nat_gateway_subnet": "public"
}
no
contextDefault context for naming and tagging purpose
object({
organization = string
environment = string
account = string
product = string
tags = map(string)
})
n/ayes
dhcp_optionsConfiguration parameters for dhcp. Per default this features are disabled
object({
domain_name = string
domain_name_servers = list(string)
ntp_servers = list(string)
netbios_name_servers = list(string)
netbios_node_type = string
})
nullno
nameName of the vpc to createstringn/ayes
share_vpc_organisation_wideShare the vpc with organisationboolfalseno
subnetsFlexible subnet mapping option
map(object({
operation_mode = string
transit_gateway_routes = list(string)
mappings = map(object({
cidr = string
availability_zone_id = string
public_ip_on_launch = bool
tags = map(string)
}))
}))
n/ayes
tagsA list of tags to addmap(string){}no
transit_gateway_idID of the transit gateway to attach the vpc tostring""no
transit_gateway_routesRoutes to be added to the transit gatewaylist(string)[]no
transit_gateway_subnet_mapSubnet mapping for the transit gatewaystring""no

Outputs

NameDescription
aws_ec2_transit_gateway_vpc_attachmentoutput from resource aws_ec2_transit_gateway_vpc_attachment according to https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ec2_transit_gateway_vpc_attachment
contextExported context from input variable
internet_gatewayOutput from resource aws_internet_gateway according to https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/internet_gateway
nat_gatewayOutput from resource aws_nat_gateway according to https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/nat_gateway
route_tablesmap of output from resource aws_route_table according to https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route_table
subnet_cidrslist of all associated subnet cidrs
subnet_idsmap of output from resource aws_subnet according to https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/subnet
subnetsmap of output from resource aws_subnet according to https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/subnet
tempn/a
transit_gateway_routesmap of output from resource aws_subnet according to https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/subnet
vpcMap of aws_vpc according to https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc