2022-08-06 14:21:18 +00:00
|
|
|
package resource
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
"github.com/hashicorp/terraform-plugin-sdk/v2/internal/logging"
|
2022-12-24 16:57:19 +00:00
|
|
|
"github.com/hashicorp/terraform-plugin-sdk/v2/internal/plugintest"
|
2022-08-06 14:21:18 +00:00
|
|
|
)
|
|
|
|
|
2022-12-24 16:57:19 +00:00
|
|
|
func testStepTaint(ctx context.Context, step TestStep, wd *plugintest.WorkingDir) error {
|
2022-08-06 14:21:18 +00:00
|
|
|
if len(step.Taint) == 0 {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
logging.HelperResourceTrace(ctx, fmt.Sprintf("Using TestStep Taint: %v", step.Taint))
|
|
|
|
|
|
|
|
for _, p := range step.Taint {
|
2022-12-24 16:57:19 +00:00
|
|
|
err := wd.Taint(ctx, p)
|
|
|
|
if err != nil {
|
|
|
|
return fmt.Errorf("error tainting resource: %s", err)
|
2022-08-06 14:21:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|