diff --git a/examples/complete/main.tf b/examples/complete/main.tf index 5773b7dd..7f16007b 100644 --- a/examples/complete/main.tf +++ b/examples/complete/main.tf @@ -33,6 +33,12 @@ module "lambda_function" { s3_bucket = module.s3_bucket.s3_bucket_id s3_prefix = "lambda-builds/" + s3_object_override_default_tags = true + s3_object_tags = { + S3ObjectName = "lambda1" + Override = "true" + } + artifacts_dir = "${path.root}/.terraform/lambda-builds/" layers = [ diff --git a/main.tf b/main.tf index a2d045df..e9a35e75 100644 --- a/main.tf +++ b/main.tf @@ -190,6 +190,16 @@ resource "aws_s3_object" "lambda_package" { tags = var.s3_object_tags_only ? var.s3_object_tags : merge(var.tags, var.s3_object_tags) + dynamic "override_provider" { + for_each = var.s3_object_override_default_tags ? [true] : [] + + content { + default_tags { + tags = {} + } + } + } + depends_on = [null_resource.archive] } diff --git a/variables.tf b/variables.tf index 861ce789..55816734 100644 --- a/variables.tf +++ b/variables.tf @@ -282,6 +282,12 @@ variable "invoke_mode" { default = null } +variable "s3_object_override_default_tags" { + description = "Whether to override the default_tags from provider? NB: S3 objects support a maximum of 10 tags." + type = bool + default = false +} + ######## # Layer ######## diff --git a/wrappers/main.tf b/wrappers/main.tf index 8a51d37f..85b9e38c 100644 --- a/wrappers/main.tf +++ b/wrappers/main.tf @@ -111,6 +111,7 @@ module "wrapper" { s3_bucket = try(each.value.s3_bucket, var.defaults.s3_bucket, null) s3_existing_package = try(each.value.s3_existing_package, var.defaults.s3_existing_package, null) s3_kms_key_id = try(each.value.s3_kms_key_id, var.defaults.s3_kms_key_id, null) + s3_object_override_default_tags = try(each.value.s3_object_override_default_tags, var.defaults.s3_object_override_default_tags, false) s3_object_storage_class = try(each.value.s3_object_storage_class, var.defaults.s3_object_storage_class, "ONEZONE_IA") s3_object_tags = try(each.value.s3_object_tags, var.defaults.s3_object_tags, {}) s3_object_tags_only = try(each.value.s3_object_tags_only, var.defaults.s3_object_tags_only, false)