mirror of
https://github.com/bpg/terraform-provider-proxmox.git
synced 2025-07-02 19:43:00 +00:00
fix(firewall): Improve firewall resources argument validation (#359)
Make sure VM / Container rules, SGs, IPSets are always include `node_name` along with `vm_id`, `container_id`.
This commit is contained in:
parent
9587c6383c
commit
8c1f246b5a
@ -30,14 +30,16 @@ func selectorSchema() map[string]*schema.Schema {
|
|||||||
Description: "The name of the node.",
|
Description: "The name of the node.",
|
||||||
},
|
},
|
||||||
mkSelectorVMID: {
|
mkSelectorVMID: {
|
||||||
Type: schema.TypeInt,
|
Type: schema.TypeInt,
|
||||||
Optional: true,
|
Optional: true,
|
||||||
Description: "The ID of the VM to manage the firewall for.",
|
Description: "The ID of the VM to manage the firewall for.",
|
||||||
|
RequiredWith: []string{mkSelectorNodeName},
|
||||||
},
|
},
|
||||||
mkSelectorContainerID: {
|
mkSelectorContainerID: {
|
||||||
Type: schema.TypeInt,
|
Type: schema.TypeInt,
|
||||||
Optional: true,
|
Optional: true,
|
||||||
Description: "The ID of the container to manage the firewall for.",
|
Description: "The ID of the container to manage the firewall for.",
|
||||||
|
RequiredWith: []string{mkSelectorNodeName},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -46,6 +48,9 @@ func selectorSchemaMandatory() map[string]*schema.Schema {
|
|||||||
s := selectorSchema()
|
s := selectorSchema()
|
||||||
s[mkSelectorNodeName].Optional = false
|
s[mkSelectorNodeName].Optional = false
|
||||||
s[mkSelectorNodeName].Required = true
|
s[mkSelectorNodeName].Required = true
|
||||||
|
// required attributes can't be included in RequiredWith
|
||||||
|
s[mkSelectorVMID].RequiredWith = nil
|
||||||
|
s[mkSelectorContainerID].RequiredWith = nil
|
||||||
|
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user