From 426366f45d90c872676bd9c39588a3f36227ee01 Mon Sep 17 00:00:00 2001 From: bdeshi Date: Fri, 17 May 2024 23:46:50 +0600 Subject: [PATCH] update readme --- README.md | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index d051579..975c9a9 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Terraform AWS Pre-Base +# Terraform AWS Pre-base Infrastructure ## Intro @@ -17,24 +17,34 @@ This configuration is intended to be manually executed once at the beginning by ## Usage -1. Install [terraform](https://terraform.io) or [opentofu](https://opentofu.org/) (preferably with [tfenv](https://github.com/tfutils/tfenv)). The required version is stated in `terraform.meta.tf`. +1. Install [terraform](https://terraform.io). The required version is stated in [`terraform.meta.tf`](./terraform.meta.tf). You can also use [tfenv](https://github.com/tofuutils/tenv) to automatically get a suitable version. -2. Install terraform dependencies: +2. Insert backend config values in `terraform.backend.tfvars`. See [`terraform.backend.remote.tfvars.sample`](./terraform.backend.remote.tfvars.sample) for example, or configure your preferred backend. + +3. *(optional)* Login to terraform cloud to use the remote backend: ```bash - terraform init -upgrade + terraform login ``` -3. Insert org-specific variable values in `.tfvars`. See `*.tfvars.sample` for example. - -4. Then execute as: +4. Install terraform dependencies and initiate the backend: ```bash - terraform apply -var-file=.tfvars + terraform init -backend-config=terraform.backend.tfvars + ``` + +5. Insert deployment-specific values in `terraform.tfvars`. See [`terraform.tfvars.sample`](./terraform.tfvars.sample) for example. + +6. Then execute as: + + ```bash + terraform apply -var-file=terraform.tfvars ``` ## Notes -The terraform state is not saved in s3, because it is assumed that no s3 bucket for terraform states exists yet. User should secure the state file using some other method. +- ⚠️ **This project's state file should not be saved in the same AWS account where it is being deployed.** -Generated outputs are saved in a parameter store tree for future reference. +- The terraform state is not saved in s3, because it is assumed that no s3 bucket for terraform states exists yet. Instead the [terraform cloud](https://app.terraform.io/) remote backend is used. You may need to setup an account there. Or use local or your preferred backend. You should ensure security of the state file. + +- Generated outputs are also saved in a parameter store tree for future reference.