https://github.com/timoa/terraform-google-module-example
A Terraform module uses as an example to start new Google Cloud Platform Terraform module. It includes all the automation (versioning, providers update, lint, security) and best practices from HashiCorp
https://github.com/timoa/terraform-google-module-example
gcp google-cloud-platform managed-by-terraform renovate semantic-release terraform terraform-module
Last synced: 3 months ago
JSON representation
A Terraform module uses as an example to start new Google Cloud Platform Terraform module. It includes all the automation (versioning, providers update, lint, security) and best practices from HashiCorp
- Host: GitHub
- URL: https://github.com/timoa/terraform-google-module-example
- Owner: timoa
- License: apache-2.0
- Created: 2022-04-13T11:00:01.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2025-07-15T21:44:11.000Z (12 months ago)
- Last Synced: 2025-07-16T20:32:02.728Z (12 months ago)
- Topics: gcp, google-cloud-platform, managed-by-terraform, renovate, semantic-release, terraform, terraform-module
- Language: HCL
- Homepage: https://timoa.com
- Size: 265 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
- Security: SECURITY.md
Awesome Lists containing this project
README
# Terraform Google module example
[![Latest Release][release-badge]][release-url]
[![Build Status][github-badge]][github-url]
[![License][license-badge]][license-url]
A Terraform module uses as a template to start new module.
It includes all the automation (versioning, providers update, lint, security) and best practices from HashiCorp.
* [Pre-commit][pre-commit-url]: enforce checks on the module before commit
* [Semantic Release][semantic-release-url]: automate the release and version process
* [Reviewdog][reviewdog-url]: automate the review process with per code line comments (TFLint & TFSec checks)
* [Renovate][renovate-url]: automate the dependency management (update provider version, etc.)
* [ShiftLeft SCAN][shiftleft-scan-url]: security audit tool to detect security flaws in application and infrastructure code
## Usage
### GCP Authentication
```bash
gcloud auth application-default login
```
### Activate GCP APIs
Go to the [Google Cloud Platform Console](https://console.cloud.google.com/apis/library) and activate the following APIs:
* compute.googleapis.com
### Integrate the module into your Terraform project
If you want to use this module inside your project, you can use the following code (change the tag to match the latest version):
```bash
module "module-template" {
source = "git::https://github.com/timoa/terraform-google-module-example.git?ref=tags/0.0.2"
# Required
project_id = "my-project-id"
# Optional
namespace = "my-project"
stage = "prod"
region = "us-east1"
}
```
### Output example
```bash
terraform init
terraform plan
```
```bash
Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
+ create
Terraform will perform the following actions:
# module.project_factory_project_services.google_project_service.project_services["cloudresourcemanager.googleapis.com"] will be created
+ resource "google_project_service" "project_services" {
+ disable_dependent_services = true
+ disable_on_destroy = false
+ id = (known after apply)
+ project = "my-project-id"
+ service = "cloudresourcemanager.googleapis.com"
}
# module.project_factory_project_services.google_project_service.project_services["compute.googleapis.com"] will be created
+ resource "google_project_service" "project_services" {
+ disable_dependent_services = true
+ disable_on_destroy = false
+ id = (known after apply)
+ project = "my-project-id"
+ service = "compute.googleapis.com"
}
Plan: 2 to add, 0 to change, 0 to destroy.
Changes to Outputs:
+ available_zones = [
+ "us-east1-b",
+ "us-east1-c",
+ "us-east1-d",
]
```
[github-badge]: https://github.com/timoa/terraform-google-module-example/workflows/Terraform/badge.svg
[github-url]: https://github.com/timoa/terraform-google-module-example/actions?query=workflow%3ATerraform
[release-badge]: https://img.shields.io/github/release/timoa/terraform-google-module-example.svg
[release-url]: https://github.com/timoa/terraform-google-module-example/releases/latest
[license-badge]: https://img.shields.io/github/license/timoa/terraform-google-module-example.svg
[license-url]: https://github.com/timoa/terraform-google-module-example/blob/main/LICENSE
[pre-commit-url]: https://pre-commit.com/
[semantic-release-url]: https://semantic-release.gitbook.io/semantic-release/
[reviewdog-url]: https://github.com/reviewdog/reviewdog
[renovate-url]: https://www.whitesourcesoftware.com/free-developer-tools/renovate/
[shiftleft-scan-url]: https://shiftleft.io/docs/scan/