Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure state and pillar remote locations are always defined #17151

Merged
merged 2 commits into from
Feb 15, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions builtin/provisioners/salt-masterless/resource_provisioner.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,12 @@ func Provisioner() terraform.ResourceProvisioner {
"remote_state_tree": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Default: DefaultStateTreeDir,
},
"remote_pillar_roots": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Default: DefaultPillarRootDir,
},
"temp_config_dir": &schema.Schema{
Type: schema.TypeString,
Expand Down Expand Up @@ -431,20 +433,20 @@ func validateFn(c *terraform.ResourceConfig) (ws []string, es []error) {
var remoteStateTree string
remoteStateTreeTmp, ok := c.Get("remote_state_tree")
if !ok {
remoteStateTree = ""
remoteStateTree = DefaultStateTreeDir
} else {
remoteStateTree = remoteStateTreeTmp.(string)
}

var remotePillarRoots string
remotePillarRootsTmp, ok := c.Get("remote_pillar_roots")
if !ok {
remotePillarRoots = ""
remotePillarRoots = DefaultPillarRootDir
} else {
remotePillarRoots = remotePillarRootsTmp.(string)
}

if minionConfig != "" && (remoteStateTree != "" || remotePillarRoots != "") {
if minionConfig != "" && (remoteStateTree != DefaultStateTreeDir || remotePillarRoots != DefaultPillarRootDir) {
es = append(es,
errors.New("remote_state_tree and remote_pillar_roots only apply when minion_config_file is not used"))
}
Expand Down