Git Product home page Git Product logo

gcp-terraform's Introduction

Terraform Google Cloud Modules

These modules make it easy to manage Google Cloud resources using Terraform.

The presented solutions are intended for learning purposes. Hence, don't treat as production-ready.

Compatibility

See Terraform documentation on Getting Started with the Google Provider.

The module was tested using Terraform v1.1.7 with Terraform Google Provider v4.13.0 on MacOs Monterey 12.2.1.

terraform {
  required_version = "~> 1.1.7"
  required_providers {
    google = {
      source  = "hashicorp/google"
      version = "4.13.0"
    }
  }
}

Service Account

Service account or user credentials with the following role(s) must be used to provision the resources of this module:

  • Storage Admin: roles/storage.admin

GCS buckets and roles

Problem Statement

This module tries to address an issue where you have a multi-tenant environment on GCP and want to use Infrastructure-as-Code (IaC) to manage the resources created in different projects and environments - dev/uat/prod.

Requirements:

  • Both the IT team and tenants must execute the IaC whenever necessary.
  • Tenants must not be required to know terraform or GCP nomenclature.
  • Each tenant has its own GitHub repository and from it you need to manage all the resources.
  • Use GCP Predefined roles
  • Create multiple buckets in multiple locations
  • Tenants can assign permission to GCP service accounts that belong to different projects, i.e. tenant1 can assign viewer permission to a tenant2 service account.

Architecture example:

flowchart TD
  id1[GCP Organisation] --> id2[Tenant1-folder]
  id1[GCP Organisation] --> id3[Tenant2-folder]
  id2[Tenant1-folder] --> id21[dev-project]
  id2[Tenant1-folder] --> id22[uat-project]
  id2[Tenant1-folder] --> id23[prod-project]
  id3[Tenant2-folder] --> id31[dev-project]
  id3[Tenant2-folder] --> id32[uat-project]
  id3[Tenant2-folder] --> id33[prod-project]
  style id1 stroke:#000
  style id2 fill:#f96,stroke:#000
  style id3 fill:#f96,stroke:#000
  style id21 fill:#ffd,stroke:#000
  style id22 fill:#ffd,stroke:#000
  style id23 fill:#ffd,stroke:#000
  style id31 fill:#ffd,stroke:#000
  style id32 fill:#ffd,stroke:#000
  style id33 fill:#ffd,stroke:#000

Flowchart created using Mermaid

Proposed Solution

Testing the Terraform code

gcp-terraform's People

Contributors

rafaelmnatali avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.