Skip to content

Commit 3687d15

Browse files
committed
Allows @Testing(plannableImportAction) to be before @Testing(importIgnore)
1 parent 5c792e1 commit 3687d15

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

internal/generate/tests/annotations.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@ func (c CommonArgs) HasImportIgnore() bool {
8888
}
8989

9090
func (c CommonArgs) PlannableResourceAction() string {
91+
if c.plannableImportAction == importActionUnset {
92+
return importActionNoop.String()
93+
}
9194
return c.plannableImportAction.String()
9295
}
9396

@@ -100,7 +103,8 @@ func (c CommonArgs) AdditionalTfVars() map[string]TFVar {
100103
type importAction int
101104

102105
const (
103-
importActionNoop importAction = iota
106+
importActionUnset importAction = iota
107+
importActionNoop
104108
importActionUpdate
105109
importActionReplace
106110
)
@@ -203,7 +207,9 @@ func ParseTestingAnnotations(args common.Args, stuff *CommonArgs) error {
203207
for i, val := range stuff.ImportIgnore {
204208
stuff.ImportIgnore[i] = namesgen.ConstOrQuote(val)
205209
}
206-
stuff.plannableImportAction = importActionUpdate
210+
if stuff.plannableImportAction == importActionUnset {
211+
stuff.plannableImportAction = importActionUpdate
212+
}
207213
}
208214

209215
if attr, ok := args.Keyword["importStateId"]; ok {

0 commit comments

Comments
 (0)