Feature update backend (#3)
* Update Terraform backend configuration and add backend.conf sample --------- Co-authored-by: Damien A <sepales.pret0h@icloud.com>
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -43,3 +43,4 @@ network_images/*.tar.xz
|
|||||||
.vscode/settings.json
|
.vscode/settings.json
|
||||||
.vscode
|
.vscode
|
||||||
ansible/clab_vars.yml
|
ansible/clab_vars.yml
|
||||||
|
terraform/backend.conf
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ Before you begin, ensure you have the following prerequisites installed and conf
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
cd terraform
|
cd terraform
|
||||||
terraform init
|
terraform init --backend-config="backend.conf"
|
||||||
```
|
```
|
||||||
|
|
||||||
4. **Apply Terraform Configuration**
|
4. **Apply Terraform Configuration**
|
||||||
|
|||||||
@@ -10,7 +10,12 @@ This directory contains the Terraform configuration files for deploying an AWS E
|
|||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
1. **Set AWS Credentials and Variables**
|
1. **Backend Configuration**
|
||||||
|
|
||||||
|
To easily manage the backend configuration, we will store the tfstate files on an S3 bucket.
|
||||||
|
To update it, please adapt the `backend.conf` file, using the provided sample as a reference.
|
||||||
|
|
||||||
|
2. **Set AWS Credentials and Variables**
|
||||||
|
|
||||||
Rename the `terraform.tfvars.sample` to `terraform.tfvars` and update the following variables with your own values:
|
Rename the `terraform.tfvars.sample` to `terraform.tfvars` and update the following variables with your own values:
|
||||||
|
|
||||||
@@ -23,7 +28,7 @@ This directory contains the Terraform configuration files for deploying an AWS E
|
|||||||
|
|
||||||
**Important** : Never commit `terraform.tfvars` to version control as it contains sensitive information.
|
**Important** : Never commit `terraform.tfvars` to version control as it contains sensitive information.
|
||||||
|
|
||||||
2. **Customize Terraform Variables**
|
3. **Customize Terraform Variables**
|
||||||
|
|
||||||
You can customize the deployment by modifying the Terraform variables in `variables.tf`.
|
You can customize the deployment by modifying the Terraform variables in `variables.tf`.
|
||||||
|
|
||||||
|
|||||||
3
terraform/backend.conf.sample
Normal file
3
terraform/backend.conf.sample
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
bucket = "YOUR_UNIQUE_BUCKET_NAME"
|
||||||
|
key = "YOUR_OBJECT_KEY"
|
||||||
|
region = "YOUR_REGION"
|
||||||
@@ -1,9 +1,3 @@
|
|||||||
provider "aws" {
|
|
||||||
region = var.AWS_REGION
|
|
||||||
access_key = var.AWS_ACCESS_KEY
|
|
||||||
secret_key = var.AWS_SECRET_KEY
|
|
||||||
}
|
|
||||||
|
|
||||||
resource "aws_security_group" "netlab_sg" {
|
resource "aws_security_group" "netlab_sg" {
|
||||||
name = "netlab_sg"
|
name = "netlab_sg"
|
||||||
|
|
||||||
|
|||||||
9
terraform/provider.tf
Normal file
9
terraform/provider.tf
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
provider "aws" {
|
||||||
|
region = var.AWS_REGION
|
||||||
|
access_key = var.AWS_ACCESS_KEY
|
||||||
|
secret_key = var.AWS_SECRET_KEY
|
||||||
|
}
|
||||||
|
|
||||||
|
terraform {
|
||||||
|
backend "s3" {}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user