@@ -42,6 +42,7 @@ type ManagedResource struct {
42
42
PreventDestroy bool
43
43
IgnoreChanges []hcl.Traversal
44
44
IgnoreAllChanges bool
45
+ ReplaceTriggeredBy []hcl.Traversal
45
46
46
47
CreateBeforeDestroySet bool
47
48
PreventDestroySet bool
@@ -236,6 +237,32 @@ func decodeResourceBlock(block *hcl.Block) (*Resource, hcl.Diagnostics) {
236
237
}
237
238
238
239
}
240
+ if attr , exists := lcContent .Attributes ["replace_triggered_by" ]; exists {
241
+
242
+ // ignore_changes can either be a list of relative traversals
243
+ // or it can be just the keyword "all" to ignore changes to this
244
+ // resource entirely.
245
+ // ignore_changes = [ami, instance_type]
246
+ // ignore_changes = all
247
+ // We also allow two legacy forms for compatibility with earlier
248
+ // versions:
249
+ // ignore_changes = ["ami", "instance_type"]
250
+ // ignore_changes = ["*"]
251
+
252
+ exprs , listDiags := hcl .ExprList (attr .Expr )
253
+ diags = append (diags , listDiags ... )
254
+
255
+ for _ , expr := range exprs {
256
+ expr , shimDiags := shimTraversalInString (expr , false )
257
+ diags = append (diags , shimDiags ... )
258
+
259
+ traversal , travDiags := hcl .RelTraversalForExpr (expr )
260
+ diags = append (diags , travDiags ... )
261
+ if len (traversal ) != 0 {
262
+ r .Managed .ReplaceTriggeredBy = append (r .Managed .ReplaceTriggeredBy , traversal )
263
+ }
264
+ }
265
+ }
239
266
240
267
case "connection" :
241
268
if seenConnection != nil {
@@ -568,5 +595,8 @@ var resourceLifecycleBlockSchema = &hcl.BodySchema{
568
595
{
569
596
Name : "ignore_changes" ,
570
597
},
598
+ {
599
+ Name : "replace_triggered_by" ,
600
+ },
571
601
},
572
602
}
0 commit comments