croguerrero / gcp-infra-by-terraform

GCP Terraform example for use in production

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GCP infra by Terraform

It is a boilerplate code project that can be used universally. Go to the samples directory and use it. Any contributions are welcome as long as they don't hurt the overall structure. Let's play together!

example

example directory description
01_welcome_terraform This is a basic example for training Terraform. Create a VPC in the cloud
02_compute_engine Create a VM instance
03_instance_group Create the following resources: Cloud Load Balancer, Instance templates, Instance groups
10_kubernetes_engine Create a GKE cluster
20_cloudrun Create an artifact registry and create a cloud run service that takes images from artifact_registry
30_cloud_sql Create a database
35_memorystore_redis Create a memorystore(redis)
40_cloud_storage Create a bucket
50_cloud_composer Create Cloud Composer 2
60_cloud_pubpub Create one topic and two subscriptions. Subscriptions are push and pull respectively

Requirements

Usage

Specify the path of the key file as an environment variable.

$ export GOOGLE_CLOUD_KEYFILE_JSON=/path/to/file

You must enter the project_id at run time. If you don't like it, set it as an environment variable like the one below.

$ export TF_VAR_project_id="foo-1234"

And go to the samples directory. Run Terraform in terminal like below! You are initializing

$ terraform init

Check the terraform plan.

$ terraform plan

And apply!

$ terraform apply

To clean up resources, use the destroy command.

$ terraform destroy

Precautions

Some services require you to enable resources in the GCP Console.

License

MIT

About

GCP Terraform example for use in production

License:MIT License


Languages

Language:HCL 100.0%