mirror of
https://github.com/bpg/terraform-provider-proxmox.git
synced 2025-06-30 02:31:10 +00:00
fix: missing reference to standalone terraform plugin and duplicate output names in example
This commit is contained in:
parent
550ab62a7a
commit
0fd8d3dae7
@ -2,6 +2,6 @@ data "proxmox_virtual_environment_cluster_alias" "example" {
|
||||
name = "example"
|
||||
}
|
||||
|
||||
output "proxmox_virtual_environment_cluster_alias_example_cidr" {
|
||||
output "data_proxmox_virtual_environment_cluster_alias_example_cidr" {
|
||||
value = proxmox_virtual_environment_cluster_alias.example.cidr
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ data "proxmox_virtual_environment_cluster_aliases" "example" {
|
||||
depends_on = ["proxmox_virtual_environment_cluster_alias.example"]
|
||||
}
|
||||
|
||||
output "proxmox_virtual_environment_cluster_aliases" {
|
||||
output "data_proxmox_virtual_environment_cluster_aliases" {
|
||||
value = "${map(
|
||||
"alias_ids", data.proxmox_virtual_environment_cluster_aliases.example.alias_ids,
|
||||
)}"
|
||||
|
@ -5,16 +5,15 @@
|
||||
package proxmoxtf
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/terraform/helper/schema"
|
||||
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
|
||||
)
|
||||
|
||||
const (
|
||||
dvDataVirtualEnvironmentClusterAliasComment = ""
|
||||
|
||||
mkDataSourceVirtualEnvironmentClusterAliasName = "name"
|
||||
mkDataSourceVirtualEnvironmentClusterAliasCIDR = "cidr"
|
||||
mkDataSourceVirtualEnvironmentClusterAliasComment = "comment"
|
||||
dvDataVirtualEnvironmentClusterAliasComment = ""
|
||||
|
||||
mkDataSourceVirtualEnvironmentClusterAliasName = "name"
|
||||
mkDataSourceVirtualEnvironmentClusterAliasCIDR = "cidr"
|
||||
mkDataSourceVirtualEnvironmentClusterAliasComment = "comment"
|
||||
)
|
||||
|
||||
func dataSourceVirtualEnvironmentClusterAlias() *schema.Resource {
|
||||
@ -35,7 +34,6 @@ func dataSourceVirtualEnvironmentClusterAlias() *schema.Resource {
|
||||
Description: "Alias comment",
|
||||
Computed: true,
|
||||
},
|
||||
|
||||
},
|
||||
Read: dataSourceVirtualEnvironmentAliasRead,
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ package proxmoxtf
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/terraform/helper/schema"
|
||||
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
|
||||
)
|
||||
|
||||
// TestDataSourceVirtualEnvironmentAliasInstantiation tests whether the DataSourceVirtualEnvironmentAlias instance can be instantiated.
|
||||
@ -33,8 +33,8 @@ func TestDataSourceVirtualEnvironmentAliasSchema(t *testing.T) {
|
||||
})
|
||||
|
||||
testValueTypes(t, s, map[string]schema.ValueType{
|
||||
mkDataSourceVirtualEnvironmentClusterAliasName: schema.TypeString,
|
||||
mkDataSourceVirtualEnvironmentClusterAliasCIDR: schema.TypeString,
|
||||
mkDataSourceVirtualEnvironmentClusterAliasName: schema.TypeString,
|
||||
mkDataSourceVirtualEnvironmentClusterAliasCIDR: schema.TypeString,
|
||||
mkDataSourceVirtualEnvironmentClusterAliasComment: schema.TypeString,
|
||||
})
|
||||
}
|
||||
|
@ -5,11 +5,11 @@
|
||||
package proxmoxtf
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/terraform/helper/schema"
|
||||
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
|
||||
)
|
||||
|
||||
const (
|
||||
mkDataSourceVirtualEnvironmentClusterAliasesAliasIDs = "alias_ids"
|
||||
mkDataSourceVirtualEnvironmentClusterAliasesAliasIDs = "alias_ids"
|
||||
)
|
||||
|
||||
func dataSourceVirtualEnvironmentClusterAliases() *schema.Resource {
|
||||
|
@ -7,7 +7,7 @@ package proxmoxtf
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/terraform/helper/schema"
|
||||
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
|
||||
)
|
||||
|
||||
// TestDataSourceVirtualEnvironmentAliasesInstantiation tests whether the DataSourceVirtualEnvironmentAliases instance can be instantiated.
|
||||
|
@ -5,43 +5,44 @@
|
||||
package proxmoxtf
|
||||
|
||||
import (
|
||||
"github.com/danitso/terraform-provider-proxmox/proxmox"
|
||||
"github.com/hashicorp/terraform/helper/schema"
|
||||
"strings"
|
||||
|
||||
"github.com/danitso/terraform-provider-proxmox/proxmox"
|
||||
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
|
||||
)
|
||||
|
||||
const (
|
||||
dvResourceVirtualEnvironmentClusterAliasComment = ""
|
||||
dvResourceVirtualEnvironmentClusterAliasComment = ""
|
||||
|
||||
mkResourceVirtualEnvironmentClusterAliasName = "name"
|
||||
mkResourceVirtualEnvironmentClusterAliasCIDR = "cidr"
|
||||
mkResourceVirtualEnvironmentClusterAliasComment = "comment"
|
||||
mkResourceVirtualEnvironmentClusterAliasName = "name"
|
||||
mkResourceVirtualEnvironmentClusterAliasCIDR = "cidr"
|
||||
mkResourceVirtualEnvironmentClusterAliasComment = "comment"
|
||||
)
|
||||
|
||||
func resourceVirtualEnvironmentClusterAlias() *schema.Resource {
|
||||
return &schema.Resource{
|
||||
Schema: map[string]*schema.Schema{
|
||||
mkResourceVirtualEnvironmentClusterAliasName: {
|
||||
Type: schema.TypeString,
|
||||
Type: schema.TypeString,
|
||||
Description: "Alias name",
|
||||
Required: true,
|
||||
ForceNew: false,
|
||||
Required: true,
|
||||
ForceNew: false,
|
||||
},
|
||||
mkResourceVirtualEnvironmentClusterAliasCIDR: {
|
||||
Type: schema.TypeString,
|
||||
Type: schema.TypeString,
|
||||
Description: "IP/CIDR block",
|
||||
Required: true,
|
||||
ForceNew: false,
|
||||
Required: true,
|
||||
ForceNew: false,
|
||||
},
|
||||
mkResourceVirtualEnvironmentClusterAliasComment: {
|
||||
Type: schema.TypeString,
|
||||
Type: schema.TypeString,
|
||||
Description: "Alias comment",
|
||||
Optional: true,
|
||||
Default: dvResourceVirtualEnvironmentClusterAliasComment,
|
||||
Optional: true,
|
||||
Default: dvResourceVirtualEnvironmentClusterAliasComment,
|
||||
},
|
||||
},
|
||||
Create: resourceVirtualEnvironmentClusterAliasCreate,
|
||||
Read: resourceVirtualEnvironmentClusterAliasRead,
|
||||
Read: resourceVirtualEnvironmentClusterAliasRead,
|
||||
Update: resourceVirtualEnvironmentClusterAliasUpdate,
|
||||
Delete: resourceVirtualEnvironmentClusterAliasDelete,
|
||||
}
|
||||
@ -61,8 +62,8 @@ func resourceVirtualEnvironmentClusterAliasCreate(d *schema.ResourceData, m inte
|
||||
|
||||
body := &proxmox.VirtualEnvironmentClusterAliasCreateRequestBody{
|
||||
Comment: &comment,
|
||||
Name: name,
|
||||
CIDR: cidr,
|
||||
Name: name,
|
||||
CIDR: cidr,
|
||||
}
|
||||
|
||||
err = veClient.CreateAlias(body)
|
||||
@ -98,8 +99,8 @@ func resourceVirtualEnvironmentClusterAliasRead(d *schema.ResourceData, m interf
|
||||
|
||||
aliasMap := map[string]interface{}{
|
||||
mkResourceVirtualEnvironmentClusterAliasComment: alias.Comment,
|
||||
mkResourceVirtualEnvironmentClusterAliasName: alias.Name,
|
||||
mkResourceVirtualEnvironmentClusterAliasCIDR: alias.CIDR,
|
||||
mkResourceVirtualEnvironmentClusterAliasName: alias.Name,
|
||||
mkResourceVirtualEnvironmentClusterAliasCIDR: alias.CIDR,
|
||||
}
|
||||
|
||||
for key, val := range aliasMap {
|
||||
@ -127,8 +128,8 @@ func resourceVirtualEnvironmentClusterAliasUpdate(d *schema.ResourceData, m inte
|
||||
previousName := d.Id()
|
||||
|
||||
body := &proxmox.VirtualEnvironmentClusterAliasUpdateRequestBody{
|
||||
ReName: newName,
|
||||
CIDR: cidr,
|
||||
ReName: newName,
|
||||
CIDR: cidr,
|
||||
Comment: &comment,
|
||||
}
|
||||
|
||||
@ -143,7 +144,6 @@ func resourceVirtualEnvironmentClusterAliasUpdate(d *schema.ResourceData, m inte
|
||||
return resourceVirtualEnvironmentClusterAliasRead(d, m)
|
||||
}
|
||||
|
||||
|
||||
func resourceVirtualEnvironmentClusterAliasDelete(d *schema.ResourceData, m interface{}) error {
|
||||
config := m.(providerConfiguration)
|
||||
veClient, err := config.GetVEClient()
|
||||
@ -168,17 +168,3 @@ func resourceVirtualEnvironmentClusterAliasDelete(d *schema.ResourceData, m inte
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -7,7 +7,7 @@ package proxmoxtf
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/terraform/helper/schema"
|
||||
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
|
||||
)
|
||||
|
||||
// TestResourceVirtualEnvironmentAliasInstantiation tests whether the ResourceVirtualEnvironmentAlias instance can be instantiated.
|
||||
@ -33,8 +33,8 @@ func TestResourceVirtualEnvironmentAliasSchema(t *testing.T) {
|
||||
})
|
||||
|
||||
testValueTypes(t, s, map[string]schema.ValueType{
|
||||
mkResourceVirtualEnvironmentClusterAliasName: schema.TypeString,
|
||||
mkResourceVirtualEnvironmentClusterAliasCIDR: schema.TypeString,
|
||||
mkResourceVirtualEnvironmentClusterAliasComment: schema.TypeString,
|
||||
mkResourceVirtualEnvironmentClusterAliasName: schema.TypeString,
|
||||
mkResourceVirtualEnvironmentClusterAliasCIDR: schema.TypeString,
|
||||
mkResourceVirtualEnvironmentClusterAliasComment: schema.TypeString,
|
||||
})
|
||||
}
|
||||
|
@ -5,9 +5,10 @@
|
||||
package proxmoxtf
|
||||
|
||||
import (
|
||||
"github.com/danitso/terraform-provider-proxmox/proxmox"
|
||||
"github.com/hashicorp/terraform/helper/schema"
|
||||
"strings"
|
||||
|
||||
"github.com/danitso/terraform-provider-proxmox/proxmox"
|
||||
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -25,26 +26,26 @@ func resourceVirtualEnvironmentClusterIPSet() *schema.Resource {
|
||||
return &schema.Resource{
|
||||
Schema: map[string]*schema.Schema{
|
||||
mkResourceVirtualEnvironmentClusterIPSetName: {
|
||||
Type: schema.TypeString,
|
||||
Type: schema.TypeString,
|
||||
Description: "IPSet name",
|
||||
Required: true,
|
||||
ForceNew: false,
|
||||
Required: true,
|
||||
ForceNew: false,
|
||||
},
|
||||
mkResourceVirtualEnvironmentClusterIPSetCIDR: {
|
||||
Type: schema.TypeList,
|
||||
Type: schema.TypeList,
|
||||
Description: "List of IP or Networks",
|
||||
Optional: true,
|
||||
ForceNew: true,
|
||||
Optional: true,
|
||||
ForceNew: true,
|
||||
DefaultFunc: func() (interface{}, error) {
|
||||
return []interface{}{}, nil
|
||||
},
|
||||
Elem: &schema.Resource{
|
||||
Schema: map[string]*schema.Schema{
|
||||
mkResourceVirtualEnvironmentClusterIPSetCIDRName: {
|
||||
Type: schema.TypeString,
|
||||
Type: schema.TypeString,
|
||||
Description: "Network/IP specification in CIDR format",
|
||||
Required: true,
|
||||
ForceNew: true,
|
||||
Required: true,
|
||||
ForceNew: true,
|
||||
},
|
||||
mkResourceVirtualEnvironmentClusterIPSetCIDRNoMatch: {
|
||||
Type: schema.TypeBool,
|
||||
@ -71,7 +72,7 @@ func resourceVirtualEnvironmentClusterIPSet() *schema.Resource {
|
||||
},
|
||||
},
|
||||
Create: resourceVirtualEnvironmentClusterIPSetCreate,
|
||||
Read: resourceVirtualEnvironmentClusterIPSetRead,
|
||||
Read: resourceVirtualEnvironmentClusterIPSetRead,
|
||||
Update: resourceVirtualEnvironmentClusterIPSetUpdate,
|
||||
Delete: resourceVirtualEnvironmentClusterIPSetDelete,
|
||||
}
|
||||
@ -95,11 +96,10 @@ func resourceVirtualEnvironmentClusterIPSetCreate(d *schema.ResourceData, m inte
|
||||
IPSetMap := v.(map[string]interface{})
|
||||
IPSetObject := proxmox.VirtualEnvironmentClusterIPSetGetResponseData{}
|
||||
|
||||
cidr := IPSetMap[mkResourceVirtualEnvironmentClusterIPSetCIDRName].(string)
|
||||
cidr := IPSetMap[mkResourceVirtualEnvironmentClusterIPSetCIDRName].(string)
|
||||
noMatch := IPSetMap[mkResourceVirtualEnvironmentClusterIPSetCIDRNoMatch].(bool)
|
||||
comment := IPSetMap[mkResourceVirtualEnvironmentClusterIPSetCIDRComment].(string)
|
||||
|
||||
|
||||
IPSetObject.Comment = comment
|
||||
IPSetObject.CIDR = cidr
|
||||
|
||||
@ -108,13 +108,12 @@ func resourceVirtualEnvironmentClusterIPSetCreate(d *schema.ResourceData, m inte
|
||||
IPSetObject.NoMatch = &noMatchBool
|
||||
}
|
||||
|
||||
|
||||
IPSetsArray[i] = IPSetObject
|
||||
}
|
||||
|
||||
body := &proxmox.VirtualEnvironmentClusterIPSetCreateRequestBody{
|
||||
Comment: comment,
|
||||
Name: name,
|
||||
Name: name,
|
||||
}
|
||||
|
||||
err = veClient.CreateIPSet(body)
|
||||
@ -167,7 +166,6 @@ func resourceVirtualEnvironmentClusterIPSetRead(d *schema.ResourceData, m interf
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
IPSet, err := veClient.GetListIPSetContent(name)
|
||||
|
||||
if err != nil {
|
||||
@ -199,8 +197,8 @@ func resourceVirtualEnvironmentClusterIPSetUpdate(d *schema.ResourceData, m inte
|
||||
previousName := d.Id()
|
||||
|
||||
body := &proxmox.VirtualEnvironmentClusterIPSetUpdateRequestBody{
|
||||
ReName: previousName,
|
||||
Name: newName,
|
||||
ReName: previousName,
|
||||
Name: newName,
|
||||
Comment: &comment,
|
||||
}
|
||||
|
||||
@ -215,7 +213,6 @@ func resourceVirtualEnvironmentClusterIPSetUpdate(d *schema.ResourceData, m inte
|
||||
return resourceVirtualEnvironmentClusterIPSetRead(d, m)
|
||||
}
|
||||
|
||||
|
||||
func resourceVirtualEnvironmentClusterIPSetDelete(d *schema.ResourceData, m interface{}) error {
|
||||
config := m.(providerConfiguration)
|
||||
veClient, err := config.GetVEClient()
|
||||
@ -257,17 +254,3 @@ func resourceVirtualEnvironmentClusterIPSetDelete(d *schema.ResourceData, m inte
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -5,8 +5,9 @@
|
||||
package proxmoxtf
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/terraform/helper/schema"
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
|
||||
)
|
||||
|
||||
// TestResourceVirtualEnvironmentIPSetInstantiation tests whether the resourceVirtualEnvironmentClusterIPSet
|
||||
|
Loading…
Reference in New Issue
Block a user