Skip to content

livelifelively/infrastructure

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Jun 17, 2024
4a64de1 · Jun 17, 2024

History

5 Commits
May 20, 2024
May 20, 2024
May 20, 2024
May 20, 2024
May 20, 2024
Jun 17, 2024
May 20, 2024

Repository files navigation

Terraform

Commands

  1. terraform fmt - Reformat your configuration in the standard style.
  2. terraform init - Prepare your working directory for other commands
  3. terraform validate - Check whether the configuration is valid
  4. terraform plan - Show changes required by the current configuration
  5. terraform apply - Create or update infrastructure, can add -auto-approve flag to not having to confirm changes.
  6. terraform destroy - Destroy previously-created infrastructure, can add -auto-approve flag to not having to confirm changes.

Remote state

terraform state needs to stored remotely in aws s3. To do that,

  1. we are creating s3 and dynamodb for different for all projects.
  2. these backend configs will be then passed to respective terraform repos
  3. the main creates a state remote for all projects.
  4. simply add config values to backend.hcl file in respective project.

Create genesis state

first just create the infrastructure, that is, module "tf-state" using terraform init and then terraform apply.

the main's state can be commited to github. not to be shared with others. keeping state in remote s3 bucket and dynamodb still has a possibility being deleted accidently.

If in future we want to store state for this one also in remote s3, add backend "s3" {} to backend. add backend.hcl file. run yarn tf-init, which will use backend.hcl configs. you will given option to send local state to remote, do make sure to send it.

for the rest of modules, just create the infrastructure using terraform apply. use names and region used to generate s3 bucket and dynamodb table in corresponding project's backend.hcl files.

ALSO, notice that the s3 backend can be in a different region from the infrastructure. backend.hcl has required argument for region. so lets keep all the project's s3 backends in one region only.

DO NOT DESTROY

the module "tf-state" Has all the other files, do not delete, like ever.

project admins

I can also create admin user profiles from here for different projects. #TODO

About

infrastructure for projects

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages