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

View File

@@ -10,22 +10,27 @@ This directory contains the Terraform configuration files for deploying an AWS E
## Configuration
1. **Set AWS Credentials and Variables**
1. **Backend Configuration**
Rename the `terraform.tfvars.sample` to `terraform.tfvars` and update the following variables with your own values:
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.
```tfvars
AWS_ACCESS_KEY = "your_access_key"
AWS_SECRET_KEY = "your_secret_key"
AWS_KEY_NAME = "your_key_pair_name"
AWS_KEY_LOCATION = "path_to_your_private_key"
```
2. **Set AWS Credentials and Variables**
Rename the `terraform.tfvars.sample` to `terraform.tfvars` and update the following variables with your own values:
```tfvars
AWS_ACCESS_KEY = "your_access_key"
AWS_SECRET_KEY = "your_secret_key"
AWS_KEY_NAME = "your_key_pair_name"
AWS_KEY_LOCATION = "path_to_your_private_key"
```
**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`.
## Action made by the EC2.tf file

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" {}
}