Skip to content

Commit

Permalink
WebApp - Actualizo configuración de Terraform para que use bucket exi…
Browse files Browse the repository at this point in the history
…stente
  • Loading branch information
Dario Di Gulio committed Dec 26, 2023
1 parent e9c8484 commit 848f2c9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/webApp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
cd webapp
yarn build
- name: Deploy Infrastructure
- name: Deploy Infrastructure Terraform
run: |
terraform init
terraform apply -auto-approve
Expand Down
13 changes: 9 additions & 4 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,15 @@ provider "aws" {
region = "sa-east-1"
}

data "aws_s3_bucket" "existing_bucket" {
resource "aws_s3_bucket" "webapp_bucket" {
bucket = "estelarte-web"
}

resource "aws_s3_bucket" "webapp_bucket" {
bucket = data.aws_s3_bucket.existing_bucket.bucket
}
resource "aws_s3_bucket_object" "webapp_files" {
for_each = fileset("webapp/build", "**/*")

bucket = aws_s3_bucket.webapp_bucket.bucket
key = each.value
source = "/${each.value}"
acl = "private"
}

0 comments on commit 848f2c9

Please sign in to comment.