Skip to content

gouravmongodb/terraform_GCP_automate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 

Repository files navigation

0. OPTIONAL - Create basic folder structure, if starting from scratch

chmod +x create_terraform_structure.sh ./create_terraform_structure.sh

1. Capture existing project information

Run all commands from /atlas_terraform/ location of root main.tf

terraform init

Import the existing project and bring it under the tf control:

terraform import module.project.mongodbatlas_project.example <PROJECT.ID>

For example,

terraform import module.project.mongodbatlas_project.example 65f617a6cdafb5108b9c6ef2

2. Create a MongoDB Atlas cluster in GCP region

Run all commands from /atlas_terraform/ location of root main.tf

terraform init terraform plan -var-file="terraform.tfvars" -target=module.cluster terraform apply -var-file="terraform.tfvars" -target=module.cluster terraform destroy -var-file="terraform.tfvars" -target=module.cluster

####### NOTES #######

Run the following command at any time to return all state lists:

terraform state list

For region name mappings please refer to the links below:

Use Terraform Workspaces (for environment separation) Workspaces let you maintain multiple state files (e.g., dev, staging, prod) under the same configuration.

You can switch between workspaces using:

terraform workspace select dev terraform plan terraform apply This way, the root config is the same, but states are isolated per workspace.

About

This repo has terraform scripts to automate the modules for GCCP cloud

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published