Skip to content

UKHSA Terraform Modules to deliver a IaC self-service platform. Repo managed by devops-github-repos

License

Notifications You must be signed in to change notification settings

ukhsa-collaboration/devops-terraform-modules

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Terraform Modules Repository

Welcome to the Terraform Modules Repository. This repository contains a collection of reusable Terraform modules for AWS resources, making infrastructure provisioning efficient, consistent, and reliable.

Table of Contents

Usage

Getting Started

To start using these Terraform modules, follow these steps:

  1. Clone the Repository: Begin by cloning this repository to your local machine.
  2. Start SSH Agent: Ensure your ssh agent is started and you have added your git private key. This is to allow you to downlonload the modules
  3. Create the following files in a directory of your choice:
  • main.tf: The main Terraform config
  • variables.tf: For your terraform variables
  • outputs.tf: For your Terraform Outputs
  • versions.tf: For your Terraform provider and region setup
  1. Follow the usage example specified in your required module. Examples are located in the README.md section of each module.
    • For example the ec2_autoscale module:
      module "tags" {
        source          = "[email protected]:UKHSA-Internal/devops-terraform-modules.git//terraform-modules/helpers/tags?ref=TF/helpers/tags/vALPHA_0.0.1"
      
        project         = "MyProject"
        client          = "ClientName"
        owner           = "OwnerName"
        environment     = "prod"
        additional_tags = {
          "CostCenter" = "IT-Dept"
        }
      }
      
      module "ec2_autoscale" {
        source                = "[email protected]:UKHSA-Internal/devops-terraform-modules.git//terraform-modules/ec2-autoscale?ref=ec2-autoscale/vALPHA_0.0.1"
      
        name                  = "MyProjectName"
        ami                   = "ami-0123456789abcdef0"
        instance_type         = "t2.micro"
        vpc_id                = "vpc-01234567"
        vpc_zone_identifiers  = ["subnet-0123456a", "subnet-0123456b"]
        
        # Example with SSH Access
        ingress_rules = [
          {
            from_port   = 22
            to_port     = 22
            protocol    = "tcp"
            cidr_blocks = ["0.0.0.0/0"]
          }
        ]
      
        tags                  = module.tags.tags
      }
      
      # Referencing outputs from the module
      output "asg_name" {
        value = module.ec2_autoscale.autoscaling_group_name
      }
    • Take note of the TF/helpers/tags/vALPHA_0.0.1. This is the version of the module you would like to use. We recommend you use the latest version of a module.

Templates

  • WIP - To be Updated Soon!

Modules

  • Modules are split up in the format <IaC_Tool>-modules/<cloud_provider>/<module_name>
  • Each Module has a README.md that is a autogenerated doc providing details of its respective module
  • Each Module has a CHANGELOG.md that highlights changes made to the module

Versioning

  • Modules in this repository are versioned using git tags in the format <environment>/<IaC_tool>/<cloud_provider>/<module_name>/v<sem_version>. For a list of all versions, check the tags in this repository.

Best Practices for Versioning Terraform Modules:

  1. Semantic Versioning: Use SemVer (major.minor.patch) for clear version increments.
  2. Document Changes: Update documentation and changelogs with each release.
  3. Pin Versions: In configurations, specify module versions for consistency.
  4. Limit Major Changes: Introduce backward-incompatible changes sparingly.
  5. Testing: Test modules thoroughly before releasing, especially for major updates.

Documentation Assets

Additional documentation, diagrams, and assets related to the modules can be found in the doc folder.

About

UKHSA Terraform Modules to deliver a IaC self-service platform. Repo managed by devops-github-repos

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages