0
0
mirror of https://github.com/bpg/terraform-provider-proxmox.git synced 2025-07-01 19:12:59 +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:
Pavel Boldyrev 2023-06-02 06:38:27 -04:00 committed by GitHub
parent 9587c6383c
commit 8c1f246b5a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -33,11 +33,13 @@ func selectorSchema() map[string]*schema.Schema {
Type: schema.TypeInt,
Optional: true,
Description: "The ID of the VM to manage the firewall for.",
RequiredWith: []string{mkSelectorNodeName},
},
mkSelectorContainerID: {
Type: schema.TypeInt,
Optional: true,
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[mkSelectorNodeName].Optional = false
s[mkSelectorNodeName].Required = true
// required attributes can't be included in RequiredWith
s[mkSelectorVMID].RequiredWith = nil
s[mkSelectorContainerID].RequiredWith = nil
return s
}