Skip to content

Commit

Permalink
Add an assert on proposed name, amend the error message
Browse files Browse the repository at this point in the history
  • Loading branch information
mikhailshilkov committed Jan 9, 2025
1 parent 7772878 commit f24015b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion provider/pkg/metadata/naming.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ func AssignNameIfAutonamable(randomSeed []byte, engineAutonaming *pulumirpc.Chec
if engineAutonaming != nil {
switch engineAutonaming.Mode {
case pulumirpc.CheckRequest_AutonamingOptions_DISABLE:
return errors.New("autonaming is disabled, please provide a name or generateName value")
return errors.New("autonaming is disabled, resource requires the .metadata.name field to be set")
case pulumirpc.CheckRequest_AutonamingOptions_ENFORCE, pulumirpc.CheckRequest_AutonamingOptions_PROPOSE:
contract.Assertf(engineAutonaming.ProposedName != "", "expected proposed name to be non-empty: %v", engineAutonaming)
autoname = engineAutonaming.ProposedName
}
}
Expand Down

0 comments on commit f24015b

Please sign in to comment.