Created
March 31, 2023 05:11
-
-
Save devops-school/8b6edad241343fc735005498549f0a11 to your computer and use it in GitHub Desktop.
Terraform Tutorials: Named Values – Filesystem and workspace info
This file contains hidden or 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-west-2" | |
| } | |
| resource "aws_s3_bucket" "example_bucket" { | |
| bucket = "example-bucket" | |
| acl = "private" | |
| tags = { | |
| Name = "Example Bucket" | |
| Environment = "Production" | |
| } | |
| lifecycle { | |
| prevent_destroy = true | |
| } | |
| versioning { | |
| enabled = true | |
| } | |
| # create a file in the bucket with the contents of the local file | |
| dynamic "object" { | |
| for_each = fileset("${path.module}/files", "*") | |
| content { | |
| bucket = aws_s3_bucket.example_bucket.id | |
| key = object.value | |
| source = "${path.module}/files/${object.value}" | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment