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:
Damien A
2024-04-18 19:49:56 +02:00
committed by GitHub
parent 079e139795
commit 46dba077d0
6 changed files with 29 additions and 17 deletions

1
.gitignore vendored
View File

@@ -43,3 +43,4 @@ network_images/*.tar.xz
.vscode/settings.json
.vscode
ansible/clab_vars.yml
terraform/backend.conf

View File

@@ -56,7 +56,7 @@ Before you begin, ensure you have the following prerequisites installed and conf
```bash
cd terraform
terraform init
terraform init --backend-config="backend.conf"
```
4. **Apply Terraform Configuration**

View File

@@ -10,7 +10,12 @@ This directory contains the Terraform configuration files for deploying an AWS E
## 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:
@@ -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.
2. **Customize Terraform Variables**
3. **Customize Terraform Variables**
You can customize the deployment by modifying the Terraform variables in `variables.tf`.

View File

@@ -0,0 +1,3 @@
bucket = "YOUR_UNIQUE_BUCKET_NAME"
key = "YOUR_OBJECT_KEY"
region = "YOUR_REGION"

View File

@@ -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" {
name = "netlab_sg"

9
terraform/provider.tf Normal file
View 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" {}
}