File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -116,10 +116,17 @@ resource "aws_neptune_cluster_instance" "read_replicas" {
116
116
resource "aws_neptune_cluster_snapshot" "this" {
117
117
count = var. create_neptune_cluster_snapshot ? 1 : 0
118
118
119
- db_cluster_identifier = try (aws_neptune_cluster. this [0 ]. id , var. db_cluster_identifier )
119
+ db_cluster_identifier = (var. create_neptune_cluster
120
+ ? aws_neptune_cluster. this [0 ]. id
121
+ : var. db_cluster_identifier
122
+ )
123
+
120
124
db_cluster_snapshot_identifier = coalesce (
121
125
var. db_cluster_snapshot_identifier ,
122
- format (" %s-%s" , aws_neptune_cluster. this [0 ]. id , random_id. snapshot_suffix . hex )
126
+ format (" %s-%s" ,
127
+ aws_neptune_cluster. this [0 ]. id ,
128
+ random_id. snapshot_suffix [0 ]. hex
129
+ )
123
130
)
124
131
125
132
dynamic "timeouts" {
@@ -308,6 +315,8 @@ resource "aws_iam_role_policy_attachment" "this" {
308
315
# #####################
309
316
310
317
resource "random_id" "snapshot_suffix" {
318
+ count = var. create_neptune_cluster_snapshot && var. create_neptune_cluster ? 1 : 0
319
+
311
320
keepers = {
312
321
cluster_identifier = aws_neptune_cluster.this[0 ].id
313
322
}
You can’t perform that action at this time.
0 commit comments