Created
March 14, 2023 20:46
-
-
Save knowsuchagency/8e45192c0625dd14aae57cfd6824f932 to your computer and use it in GitHub Desktop.
deploy dags terraform configu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
provider "aws" { | |
region = "us-east-1" | |
} | |
data "aws_s3_bucket" "dev" { | |
bucket = "..." | |
} | |
# Create a data source for each file in dags folder | |
data "local_file" "dags" { | |
for_each = fileset(path.module, "dags/*") | |
filename = "${path.module}/${each.value}" | |
} | |
# Use the content_base64 attribute of local_file as etag for aws_s3_object | |
resource "aws_s3_object" "dags" { | |
for_each = data.local_file.dags | |
bucket = data.aws_s3_bucket.dev.id | |
key = "dags/${basename(each.value.filename)}" | |
source = each.value.filename | |
etag = md5(each.value.content_base64) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment