Add OpenTofu setup and configuration for AWS infrastructure
- Create action for setting up OpenTofu environment - Update Terraform workflow to use OpenTofu for infrastructure management - Modify backend configuration for S3 with new bucket and region - Add S3 bucket resources with lifecycle configuration - Update local variables and remove deprecated files - Include required Python packages for OpenTofu
This commit is contained in:
@@ -1 +0,0 @@
|
||||
../../repository.vault
|
||||
@@ -1,7 +1,7 @@
|
||||
terraform {
|
||||
backend "s3" {
|
||||
bucket = "a13labs.infra"
|
||||
key = "aws-alarms.tfstate"
|
||||
region = "us-east-1"
|
||||
bucket = "a13labs.infra.eu"
|
||||
key = "aws.core.infra.tfstate"
|
||||
region = "eu-west-1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
resource "aws_s3_bucket" "infra_bucket" {
|
||||
bucket = "a13labs.infra.eu"
|
||||
force_destroy = true
|
||||
}
|
||||
|
||||
resource "aws_s3_bucket_public_access_block" "infra_bucket" {
|
||||
bucket = aws_s3_bucket.infra_bucket.id
|
||||
|
||||
block_public_acls = true
|
||||
ignore_public_acls = true
|
||||
block_public_policy = true
|
||||
restrict_public_buckets = true
|
||||
}
|
||||
|
||||
resource "aws_s3_bucket_versioning" "infra_bucket" {
|
||||
bucket = aws_s3_bucket.infra_bucket.id
|
||||
|
||||
versioning_configuration {
|
||||
status = "Enabled"
|
||||
}
|
||||
}
|
||||
|
||||
resource "aws_s3_bucket_lifecycle_configuration" "infra_bucket" {
|
||||
bucket = aws_s3_bucket.infra_bucket.id
|
||||
|
||||
rule {
|
||||
id = "clenaup"
|
||||
status = "Enabled"
|
||||
filter {
|
||||
prefix = "/"
|
||||
}
|
||||
expiration {
|
||||
days = 30
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
import {
|
||||
id = "a13labs.infra.eu"
|
||||
to = aws_s3_bucket.infra_bucket
|
||||
}
|
||||
|
||||
import {
|
||||
id = "a13labs.infra.eu"
|
||||
to = aws_s3_bucket_public_access_block.infra_bucket
|
||||
}
|
||||
|
||||
import {
|
||||
id = "a13labs.infra.eu"
|
||||
to = aws_s3_bucket_versioning.infra_bucket
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
locals {
|
||||
region = "us-east-1"
|
||||
region = "eu-west-1"
|
||||
billing_alarm_limit = 20
|
||||
billing_alarm_emails = "c.alexandre.pires@gmail.com"
|
||||
billing_alarm_emails = "c.alexandre.pires@alexpires.me"
|
||||
account_id = data.aws_caller_identity.current.account_id
|
||||
}
|
||||
|
||||
data "aws_caller_identity" "current" {}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
variable "region" {
|
||||
description = "AWS Default region"
|
||||
default = "us-east-1"
|
||||
default = "eu-west-1"
|
||||
}
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
terraform {
|
||||
required_version = ">= 0.13"
|
||||
}
|
||||
Reference in New Issue
Block a user