Skip to content

Commit 4fb9d9b

Browse files
committed
use try instead of ternary, fix #7
1 parent f288ad6 commit 4fb9d9b

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ locals {
1010
iam_account_principals = formatlist("arn:aws:iam::%s:root", local.account_ids)
1111

1212
# Resolve resource names
13-
bucket = var.remote_bucket == "" ? aws_s3_bucket.this[0].id : var.remote_bucket
14-
kms_key_id = var.kms_key_id == "" ? aws_kms_key.this[0].arn : var.kms_key_id
13+
bucket = try(aws_s3_bucket.this[0].id, var.remote_bucket)
14+
kms_key_id = try(aws_kms_key.this[0].arn, var.kms_key_id)
1515
}
1616

1717
resource "aws_s3_bucket" "this" {

outputs.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
output "s3_bucket_backend" {
22
description = "S3 bucket"
3-
value = var.remote_bucket == "" ? aws_s3_bucket.this[0].bucket : var.remote_bucket
3+
value = try(aws_s3_bucket.this[0].bucket, var.remote_bucket)
44
}
55

66
output "kms_key_arn" {
77
description = "ARN of KMS Key for S3 bucket"
8-
value = var.kms_key_id == "" ? aws_kms_key.this[0].arn : var.kms_key_id
8+
value = try(aws_kms_key.this[0].arn, var.kms_key_id)
99
}

0 commit comments

Comments
 (0)