Skip to content

Commit 4f04ec8

Browse files
committed
Address review comments
1 parent 5b89f0a commit 4f04ec8

File tree

1 file changed

+11
-28
lines changed

1 file changed

+11
-28
lines changed

pipelines/resource_pipeline.go

Lines changed: 11 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -340,34 +340,17 @@ func ResourcePipeline() common.Resource {
340340
// Allow changing catalog value in existing pipelines, but force recreation
341341
// when switching between storage and catalog (or vice versa).
342342
// This should only run on update, thus we skip this check if the ID is not known.
343-
if d.Id() != "" {
344-
storageChanged := d.HasChange("storage")
345-
catalogChanged := d.HasChange("catalog")
346-
347-
// If both changed, it means we're switching between storage and catalog modes
348-
if storageChanged && catalogChanged {
349-
oldStorage, newStorage := d.GetChange("storage")
350-
oldCatalog, newCatalog := d.GetChange("catalog")
351-
352-
// Force new if switching from storage to catalog
353-
if oldStorage != "" && oldStorage != nil && newCatalog != "" && newCatalog != nil {
354-
if err := d.ForceNew("catalog"); err != nil {
355-
return err
356-
}
357-
if err := d.ForceNew("storage"); err != nil {
358-
return err
359-
}
360-
}
361-
362-
// Force new if switching from catalog to storage
363-
if oldCatalog != "" && oldCatalog != nil && newStorage != "" && newStorage != nil {
364-
if err := d.ForceNew("catalog"); err != nil {
365-
return err
366-
}
367-
if err := d.ForceNew("storage"); err != nil {
368-
return err
369-
}
370-
}
343+
if d.Id() == "" {
344+
return nil
345+
}
346+
347+
// If both storage and catalog changed, it means we're switching between storage and catalog modes
348+
if d.HasChange("storage") && d.HasChange("catalog") {
349+
if err := d.ForceNew("catalog"); err != nil {
350+
return err
351+
}
352+
if err := d.ForceNew("storage"); err != nil {
353+
return err
371354
}
372355
}
373356
return nil

0 commit comments

Comments
 (0)