Skip to content

Commit

Permalink
FIX: aws_s3_object limitation of only supporting up to 10 tags (#183)
Browse files Browse the repository at this point in the history
- remove extra_tags from aws_s3_object to prevent tag override and avoid
exceeding the limitation.
  • Loading branch information
Downager authored Jan 9, 2024
1 parent 17d3506 commit 2071564
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 15 deletions.
11 changes: 6 additions & 5 deletions modules/aws/irsa/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,9 @@ resource "aws_s3_bucket" "oidc" {
bucket = var.oidc_s3_bucket

tags = merge(
var.extra_tags,
{ "Name" = "${var.name}-oidc-${md5("${var.name}-oidc")}" },
var.extra_tags)
)
}

resource "aws_s3_bucket_acl" "oidc" {
Expand All @@ -85,10 +86,10 @@ resource "aws_s3_object" "discovery_json" {
issuer_host = "https://${local.odic_servername}/${var.oidc_s3_bucket}"
})

tags = merge({
tags = {
"Name" = "discovery.json"
"Role" = "k8s-master"
}, var.extra_tags)
}
}

data "local_file" "keys_json" {
Expand All @@ -106,8 +107,8 @@ resource "aws_s3_object" "keys_json" {
acl = "public-read"
content_type = "application/json"

tags = merge({
tags = {
"Name" = "keys.json"
"Role" = "k8s-master"
}, var.extra_tags)
}
}
4 changes: 2 additions & 2 deletions modules/aws/kube-etcd/ignition.tf
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,11 @@ resource "aws_s3_object" "ignition" {

server_side_encryption = "AES256"

tags = merge(var.extra_tags, {
tags = {
"Name" = "ign-etcd-${var.name}.json"
"Role" = "etcd"
"kubernetes.io/cluster/${var.name}" = "owned"
})
}
}


Expand Down
12 changes: 6 additions & 6 deletions modules/aws/kube-master/ignition.tf
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,11 @@ resource "aws_s3_object" "admin_kubeconfig" {
server_side_encryption = "AES256"
content_type = "text/plain"

tags = merge(var.extra_tags, {
tags = {
"Name" = "admin.conf"
"Role" = "k8s-master"
"kubernetes.io/cluster/${var.name}" = "owned"
})
}
}

// TODO: use AWS Secrets Manager to store this, or encryption by KMS.
Expand All @@ -184,11 +184,11 @@ resource "aws_s3_object" "bootstrapping_kubeconfig" {
server_side_encryption = "AES256"
content_type = "text/plain"

tags = merge(var.extra_tags, {
tags = {
"Name" = "bootstrap-kubelet.conf"
"Role" = "k8s-master"
"kubernetes.io/cluster/${var.name}" = "owned"
})
}
}

resource "aws_s3_object" "ignition" {
Expand All @@ -198,11 +198,11 @@ resource "aws_s3_object" "ignition" {

server_side_encryption = "AES256"

tags = merge(var.extra_tags, {
tags = {
"Name" = "ign-master-${var.name}.json"
"Role" = "k8s-master"
"kubernetes.io/cluster/${var.name}" = "owned"
})
}
}

data "ignition_config" "s3" {
Expand Down
4 changes: 2 additions & 2 deletions modules/aws/kube-worker/ignition.tf
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,11 @@ resource "aws_s3_object" "ignition" {

server_side_encryption = "AES256"

tags = merge(var.extra_tags, {
tags = {
"Name" = "ign-worker-${var.instance_config["name"]}.json"
"Role" = "k8s-worker"
"kubernetes.io/cluster/${var.name}" = "owned"
})
}
}

data "ignition_config" "s3" {
Expand Down

0 comments on commit 2071564

Please sign in to comment.