Skip to content

Commit 4a75ae8

Browse files
authored
Adds new input variable tags_s3_bucket (#230)
1 parent 6026820 commit 4a75ae8

File tree

6 files changed

+23
-3
lines changed

6 files changed

+23
-3
lines changed

main.tf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ module "statics_deploy" {
4343

4444
deployment_name = var.deployment_name
4545
tags = var.tags
46+
tags_s3_bucket = var.tags_s3_bucket
4647

4748
debug_use_local_packages = var.debug_use_local_packages
4849
tf_next_module_root = path.module
@@ -185,6 +186,7 @@ module "proxy_config" {
185186

186187
deployment_name = var.deployment_name
187188
tags = var.tags
189+
tags_s3_bucket = var.tags_s3_bucket
188190
}
189191

190192
#####################

modules/cloudfront-proxy-config/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ resource "aws_s3_bucket" "proxy_config_store" {
1212
bucket_prefix = "${var.deployment_name}-tfn-config"
1313
acl = "private"
1414
force_destroy = true
15-
tags = var.tags
15+
tags = merge(var.tags, var.tags_s3_bucket)
1616
}
1717

1818
data "aws_iam_policy_document" "cf_access" {

modules/cloudfront-proxy-config/variables.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,8 @@ variable "tags" {
3636
type = map(string)
3737
default = {}
3838
}
39+
40+
variable "tags_s3_bucket" {
41+
type = map(string)
42+
default = {}
43+
}

modules/statics-deploy/main.tf

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,13 @@ resource "aws_s3_bucket" "static_upload" {
1111
bucket_prefix = "${var.deployment_name}-tfn-deploy"
1212
acl = "private"
1313
force_destroy = true
14-
tags = var.tags
1514

1615
# We are using versioning here to ensure that no file gets overridden at upload
1716
versioning {
1817
enabled = true
1918
}
19+
20+
tags = merge(var.tags, var.tags_s3_bucket)
2021
}
2122

2223
resource "aws_s3_bucket_notification" "on_create" {
@@ -36,7 +37,6 @@ resource "aws_s3_bucket" "static_deploy" {
3637
bucket_prefix = "${var.deployment_name}-tfn-static"
3738
acl = "private"
3839
force_destroy = true
39-
tags = var.tags
4040

4141
lifecycle_rule {
4242
id = "Expire static assets"
@@ -50,6 +50,8 @@ resource "aws_s3_bucket" "static_deploy" {
5050
days = var.expire_static_assets > 0 ? var.expire_static_assets : 0
5151
}
5252
}
53+
54+
tags = merge(var.tags, var.tags_s3_bucket)
5355
}
5456

5557
# CloudFront permissions for the bucket

modules/statics-deploy/variables.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,11 @@ variable "tags" {
5656
default = {}
5757
}
5858

59+
variable "tags_s3_bucket" {
60+
type = map(string)
61+
default = {}
62+
}
63+
5964
#######
6065
# Debug
6166
#######

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,12 @@ variable "tags" {
166166
default = {}
167167
}
168168

169+
variable "tags_s3_bucket" {
170+
description = "Tag metadata to label AWS S3 buckets. Overrides tags with the same name in input variable tags."
171+
type = map(string)
172+
default = {}
173+
}
174+
169175
################
170176
# Debug Settings
171177
################

0 commit comments

Comments
 (0)