Skip to content

Commit a61f39a

Browse files
fix: Eliminate perpetual Terraform drift in 4 AWS resources (#59)
Add luthername tags to admin IAM role and Route53 zone (previously untagged), add lifecycle ignore for managed_policy_arns on the admin role, add lifecycle ignore for deprecated inline S3 bucket attributes, and set bucket_key_enabled = false on S3 encryption config to match AWS defaults. Closes #58 Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent f33da60 commit a61f39a

File tree

3 files changed

+34
-1
lines changed

3 files changed

+34
-1
lines changed

aws-platform-ui-bootstrap/admin.tf

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,22 @@
1+
module "luthername_admin_role" {
2+
source = "../luthername"
3+
luther_project = var.project
4+
aws_region = local.region
5+
luther_env = var.env
6+
org_name = var.org_name
7+
component = "admin"
8+
resource = "role"
9+
}
10+
111
resource "aws_iam_role" "admin" {
212
name = var.admin_role_name
313
description = "Provides administrator level access"
414
assume_role_policy = data.aws_iam_policy_document.assume_role.json
15+
tags = module.luthername_admin_role.tags
16+
17+
lifecycle {
18+
ignore_changes = [managed_policy_arns]
19+
}
520
}
621

722
resource "aws_iam_role_policy_attachment" "admin" {

aws-platform-ui-bootstrap/dns.tf

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
1+
module "luthername_dns_zone" {
2+
source = "../luthername"
3+
count = var.create_dns ? 1 : 0
4+
luther_project = var.project
5+
aws_region = local.region
6+
luther_env = var.env
7+
org_name = var.org_name
8+
component = "dns"
9+
resource = "zone"
10+
}
11+
112
resource "aws_route53_zone" "main" {
2-
count = var.create_dns ? 1 : 0 # Only create the resource if var.create_dns is true
13+
count = var.create_dns ? 1 : 0
314
name = var.domain
15+
tags = module.luthername_dns_zone[0].tags
416
}
517

618
output "domain" {

aws-s3-bucket/s3_buckets.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ resource "aws_s3_bucket" "bucket" {
3030
)
3131

3232
force_destroy = var.force_destroy
33+
34+
lifecycle {
35+
ignore_changes = [server_side_encryption_configuration, versioning]
36+
}
3337
}
3438

3539
resource "aws_s3_bucket_ownership_controls" "bucket" {
@@ -44,6 +48,8 @@ resource "aws_s3_bucket_server_side_encryption_configuration" "bucket" {
4448
bucket = aws_s3_bucket.bucket.id
4549

4650
rule {
51+
bucket_key_enabled = false
52+
4753
apply_server_side_encryption_by_default {
4854
kms_master_key_id = var.aws_kms_key_arn
4955
sse_algorithm = "aws:kms"

0 commit comments

Comments
 (0)