0
0
mirror of https://github.com/bpg/terraform-provider-proxmox.git synced 2025-08-25 21:05:40 +00:00

suppress duplication error in linter, fix example code

Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
This commit is contained in:
Pavel Boldyrev 2025-08-14 18:23:41 -04:00
parent b15d783658
commit 7fd3848dba
No known key found for this signature in database
GPG Key ID: 637146A2A6804C59
4 changed files with 14 additions and 9 deletions

View File

@ -1,6 +1,6 @@
data "proxmox_virtual_environment_containers" "example" { data "proxmox_virtual_environment_containers" "example" {
depends_on = [proxmox_virtual_environment_container.example] depends_on = [proxmox_virtual_environment_container.example]
tags = ["ubuntu"] tags = ["example"]
lifecycle { lifecycle {
postcondition { postcondition {
@ -12,7 +12,7 @@ data "proxmox_virtual_environment_containers" "example" {
data "proxmox_virtual_environment_containers" "template_example" { data "proxmox_virtual_environment_containers" "template_example" {
depends_on = [proxmox_virtual_environment_container.example] depends_on = [proxmox_virtual_environment_container.example]
tags = ["ubuntu"] tags = ["example"]
filter { filter {
name = "template" name = "template"
@ -23,12 +23,6 @@ data "proxmox_virtual_environment_containers" "template_example" {
name = "status" name = "status"
values = ["running"] values = ["running"]
} }
filter {
name = "name"
regex = true
values = [".*ubuntu.*"]
}
} }
output "proxmox_virtual_environment_containers_example" { output "proxmox_virtual_environment_containers_example" {

View File

@ -73,6 +73,11 @@ resource "proxmox_virtual_environment_container" "example" {
vm_id = proxmox_virtual_environment_container.example_template.id vm_id = proxmox_virtual_environment_container.example_template.id
} }
tags = [
"container",
]
initialization { initialization {
hostname = "terraform-provider-proxmox-example-lxc" hostname = "terraform-provider-proxmox-example-lxc"
} }

View File

@ -30,6 +30,8 @@ const (
) )
// Containers returns a resource for the Proxmox Containers. // Containers returns a resource for the Proxmox Containers.
//
//nolint:dupl // TODO: refactor to avoid duplication
func Containers() *schema.Resource { func Containers() *schema.Resource {
return &schema.Resource{ return &schema.Resource{
Schema: map[string]*schema.Schema{ Schema: map[string]*schema.Schema{
@ -198,6 +200,7 @@ func containersRead(ctx context.Context, d *schema.ResourceData, m interface{})
return diags return diags
} }
//nolint:dupl // TODO: refactor to avoid duplication
func checkContainerMatchFilters(container map[string]interface{}, filters []interface{}) (bool, error) { func checkContainerMatchFilters(container map[string]interface{}, filters []interface{}) (bool, error) {
for _, v := range filters { for _, v := range filters {
filter := v.(map[string]interface{}) filter := v.(map[string]interface{})

View File

@ -35,6 +35,8 @@ const (
) )
// VMs returns a resource for the Proxmox VMs. // VMs returns a resource for the Proxmox VMs.
//
//nolint:dupl // TODO: refactor to avoid duplication
func VMs() *schema.Resource { func VMs() *schema.Resource {
return &schema.Resource{ return &schema.Resource{
Schema: map[string]*schema.Schema{ Schema: map[string]*schema.Schema{
@ -225,6 +227,7 @@ func getNodeNames(ctx context.Context, d *schema.ResourceData, api proxmox.Clien
return nodeNames, nil return nodeNames, nil
} }
//nolint:dupl // TODO: refactor to avoid duplication
func checkVMMatchFilters(vm map[string]interface{}, filters []interface{}) (bool, error) { func checkVMMatchFilters(vm map[string]interface{}, filters []interface{}) (bool, error) {
for _, v := range filters { for _, v := range filters {
filter := v.(map[string]interface{}) filter := v.(map[string]interface{})