GCP Terraform Modules: Scaling Your Infrastructure the easy way
With GCP Terraform Modules, you can take advantage of pre-built modules that simplify the process of creating and managing GCP resources, such as virtual machines, load balancers, databases, and more. These modules are designed to be reusable, scalable, and customizable, allowing you to quickly and easily deploy complex infrastructure configurations with just a few lines of code.
Whether you're just getting started with GCP or you're looking for a more efficient way to manage your infrastructure, GCP Terraform Modules are a great way to streamline your operations and scale your infrastructure with ease. Join us as we cover details on why to use modules, how to use and where to find more helpful resources.
Anita Gutta is Cloud Infrastructure Engineer in Google Cloud Professional Services Organization (PSO). She provides technical guidance to customers adopting Google Cloud Platform services. She works closely with clients to understand their business needs and recommends the best cloud solutions to meet those needs. She has hands-on terraform experience and leads the SME TF Community in Google Cloud. Prior to Google Anita worked in the IT industry for 25 years, the majority focused in the finance sector.
Imran Nayer is a Senior Technical Solutions Consultant at Google Cloud Professional Services. He has been working on Google Cloud since 2019. Helped companies in the healthcare, financial, and retail sectors with projects including cloud foundation, migration, and automation. He is a regular contributor to the official GCP Terraform module, aka the Cloud Foundation Toolkit. He developed the Cloud Armor Security Module and several other CFT submodules.
4. Terraform is an Infrastructure as Code (IaC) tool developed by HashiCorp that automates the
building and management of infrastructures using a declarative language
Large community
Multi-cloud
and multi-API
Open core with
enterprise support
Support for all major Cloud
providers as well as many
other services exposed
through an API (like GitHub,
Kubernetes)
Three different editions
ranging from self-hosted to
fully managed with
enterprise-level support
Thousands of third-party
providers and modules
available from the Terraform
Registry
Terraform
Anita
6. Terraform Google provider
● The Terraform provider for Google Cloud is
jointly developed by HashiCorp and
Google, with support for more than 250
Google Cloud resources.
● Beta provider versions support products
and features which are not yet Generally
Available (GA).
● Support cases can be opened for Google
provider resources.
● Cloud Foundation Toolkit modules, which cover
most Google Cloud products and are designed
to be opinionated and ready-to-use.
○ Terraform-google-module
○ GoogleCloudPlatform
● Fabric modules and examples, which are
designed as a starter kit to be forked and
owned to bootstrap Google Cloud presence,
and for rapid prototyping.
○ Cloud Foundation Fabric
PSO Terraform assets
Terraform Support by Google
Anita
10. Modules are containers for multiple resources that are used together.
A module consists of a collection of tf or json files
kept together in a directory.
● Cloud Foundation Toolkit modules, which cover most Google Cloud
products and are designed to be opinionated and ready-to-use.
○ terraform-google-module
○ GoogleCloudPlatform
● Fabric modules and examples, which are designed as a starter kit to
be forked and owned to bootstrap Google Cloud presence, and for
rapid prototyping.
Cloud Foundation Fabric vs Cloud Foundation Toolkit
Recap of Modules
Anita
11. Pre-Reqs for Modules
● Well maintained
● Large maintainer community
● Make it easy to deploy
● Should be comprehensive
Imran
12. Why Modules
● Modules are opinionated
● Easier to deploy resources
● New features are added by the community
● May also cover other requirements by the resource. Example:
Project factory, log export module
● Comprehensive testing strategy
Imran
13. Anatomy of a Module (Cloud Armor Module)
● Module walkthrough
● How many types of resources are needed to deploy cloud
armor?
● How easy is to get resource created with module?
● New features and bug fixes
● Comprehensive testing strategy
● Relationship between main modules and its sub-modules
Imran
14. ● Bug fix or Enhancement Request
○ Go to individual module github site and raise an issue
■ Cloud Foundation Toolkit
■ Fabric
● To contribute: Fork the module, create PR to contribute. PR goes
through automated testing and reviewed by Google module
maintainer team.
Module Maintenance
Imran
15. ● Terraform - crashed …. debug options / trace /
○ https://developer.hashicorp.com/terraform/internals/debugging
○ https://github.com/hashicorp/terraform
● Provider issues … gcp provider
○ https://github.com/hashicorp/terraform-provider-google
● GCP Customer can work with TAM and FSR to get it prioritized
Maintenance cont…
Anita
16. ● Write your own wrapper module on top of CFT module(s) if:
○ You need to extend the module
○ Enforce Security/Compliance rules
● Use modules to improve the consistency of your deployments.
● Use modules to organize your Terraform code.
● Use modules to share your Terraform code with others in your
organization.
Best practices for using modules
Imran
17. GCP Terraform Resources
● Terraform Provider for Google Cloud / Terraform on Google Cloud GitHub
● Terraform on Google Cloud documentation
● Getting started with Terraform on Google Cloud
● Terraform best practices
● Terraform resource samples
● Blueprints
a. Terraform modules and blueprints for Google Cloud
b. Fabric Blueprints
● Managing Cloud Infrastructure with Terraform (Quest)
● Community contribution GCP repos
a. Public - https://github.com/GoogleCloudPlatform/
b. PSO - https://github.com/GoogleCloudPlatform/professional-services
Anita