context : Lab: Functions and Conditional Expressions
solution shown :
resource “aws_s3_object” “upload_sonic_media” {
bucket = aws_s3_bucket.sonic_media.id
key = substr(each.value, 7, 20)
source = each.value
for_each = var.media
}
my solution :
resource “aws_s3_object” “upload_sonic_media” {
bucket = aws_s3_bucket.sonic_media.id
source = each.value
for_each = var.media
key = split(“/”,each.value)[2]
}
query : I tried to split it in multiple ways and then executed the commands this way, but I wanted to see what actually got uploaded, how do I find the actual KEY value which was entered or the data that was actually uploaded as an output or just some sort of feedback,
upon pasting the main solution TF said no changes are required,
but I need to understand it on a deeper level, need some sort of feedback from my implemented code,
how do I go about that?