update readme

This commit is contained in:
bdeshi 2024-05-17 23:46:50 +06:00
parent 58ab8bf827
commit 426366f45d
Signed by: bdeshi
GPG Key ID: 410D03DA9A3468E0

View File

@ -1,4 +1,4 @@
# Terraform AWS Pre-Base # Terraform AWS Pre-base Infrastructure
## Intro ## Intro
@ -17,24 +17,34 @@ This configuration is intended to be manually executed once at the beginning by
## Usage ## 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 ```bash
terraform init -upgrade terraform login
``` ```
3. Insert org-specific variable values in `<org-name>.tfvars`. See `*.tfvars.sample` for example. 4. Install terraform dependencies and initiate the backend:
4. Then execute as:
```bash ```bash
terraform apply -var-file=<org-name>.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 ## 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.