4.12.2
This commit is contained in:
dayterr
2026-08-14 16:22:01 +03:00
parent 8b4a60e448
commit 9cd93e4277
25 changed files with 879 additions and 228 deletions

View File

@@ -1,6 +1,8 @@
package extnet
import (
"net"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
)
@@ -690,7 +692,15 @@ func resourceExtnetSchemaMake() map[string]*schema.Schema {
Type: schema.TypeString,
Required: true,
// ForceNew: true,
Description: "IP network CIDR",
Description: "IP network CIDR",
ValidateFunc: validation.IsCIDR,
DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool {
_, ipnet, err := net.ParseCIDR(new)
if err != nil {
return false
}
return old == ipnet.String()
},
},
"vlan_id": {
Type: schema.TypeInt,
@@ -699,10 +709,11 @@ func resourceExtnetSchemaMake() map[string]*schema.Schema {
Description: "VLAN ID",
},
"gateway": {
Type: schema.TypeString,
Optional: true,
Computed: true,
Description: "External network gateway IP address",
Type: schema.TypeString,
Optional: true,
Computed: true,
Description: "External network gateway IP address",
ValidateFunc: validation.IsIPAddress,
},
"zone_id": {
Type: schema.TypeInt,
@@ -720,7 +731,8 @@ func resourceExtnetSchemaMake() map[string]*schema.Schema {
Optional: true,
Computed: true,
Elem: &schema.Schema{
Type: schema.TypeString,
Type: schema.TypeString,
ValidateFunc: validation.IsIPAddress,
},
Description: "List of DNS addresses",
},
@@ -729,7 +741,8 @@ func resourceExtnetSchemaMake() map[string]*schema.Schema {
Optional: true,
Computed: true,
Elem: &schema.Schema{
Type: schema.TypeString,
Type: schema.TypeString,
ValidateFunc: validation.IsIPAddress,
},
Description: "List of NTP addresses",
},
@@ -738,7 +751,8 @@ func resourceExtnetSchemaMake() map[string]*schema.Schema {
Optional: true,
Computed: true,
Elem: &schema.Schema{
Type: schema.TypeString,
Type: schema.TypeString,
ValidateFunc: validation.IsIPAddress,
},
Description: "IPs to check network availability",
},
@@ -754,19 +768,22 @@ func resourceExtnetSchemaMake() map[string]*schema.Schema {
Description: "Optional description",
},
"start_ip": {
Type: schema.TypeString,
Optional: true,
Description: "Start of IP range to be explicitly included",
Type: schema.TypeString,
Optional: true,
Description: "Start of IP range to be explicitly included",
ValidateFunc: validation.IsIPAddress,
},
"end_ip": {
Type: schema.TypeString,
Optional: true,
Description: "End of IP range to be explicitly included",
Type: schema.TypeString,
Optional: true,
Description: "End of IP range to be explicitly included",
ValidateFunc: validation.IsIPAddress,
},
"vnfdev_ip": {
Type: schema.TypeString,
Optional: true,
Description: "IP to create VNFDev with",
Type: schema.TypeString,
Optional: true,
Description: "IP to create VNFDev with",
ValidateFunc: validation.IsIPAddress,
},
"pre_reservations_num": {
Type: schema.TypeInt,
@@ -796,7 +813,8 @@ func resourceExtnetSchemaMake() map[string]*schema.Schema {
Type: schema.TypeSet,
Optional: true,
Elem: &schema.Schema{
Type: schema.TypeString,
Type: schema.TypeString,
ValidateFunc: validation.IsIPAddress,
},
Description: "IPs to exclude in current extnet pool",
},
@@ -806,12 +824,14 @@ func resourceExtnetSchemaMake() map[string]*schema.Schema {
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"ip_start": {
Type: schema.TypeString,
Required: true,
Type: schema.TypeString,
Required: true,
ValidateFunc: validation.IsIPAddress,
},
"ip_end": {
Type: schema.TypeString,
Required: true,
Type: schema.TypeString,
Required: true,
ValidateFunc: validation.IsIPAddress,
},
},
},
@@ -881,7 +901,8 @@ func resourceExtnetSchemaMake() map[string]*schema.Schema {
Type: schema.TypeSet,
Optional: true,
Elem: &schema.Schema{
Type: schema.TypeString,
Type: schema.TypeString,
ValidateFunc: validation.IsIPAddress,
},
},
},
@@ -893,9 +914,10 @@ func resourceExtnetSchemaMake() map[string]*schema.Schema {
Computed: true,
},
"sec_vnfdev_ip": {
Type: schema.TypeString,
Optional: true,
Computed: true,
Type: schema.TypeString,
Optional: true,
Computed: true,
ValidateFunc: validation.IsIPAddress,
},
"mtu": {
Type: schema.TypeInt,
@@ -954,6 +976,10 @@ func resourceExtnetSchemaMake() map[string]*schema.Schema {
Type: schema.TypeInt,
Computed: true,
},
"sec_vnfdev_id": {
Type: schema.TypeInt,
Computed: true,
},
"status": {
Type: schema.TypeString,
Computed: true,
@@ -979,6 +1005,10 @@ func resourceExtnetSchemaMake() map[string]*schema.Schema {
Type: schema.TypeString,
Computed: true,
},
"desc": {
Type: schema.TypeString,
Computed: true,
},
"domain_name": {
Type: schema.TypeString,
Computed: true,
@@ -1014,6 +1044,50 @@ func resourceExtnetSchemaMake() map[string]*schema.Schema {
Type: schema.TypeInt,
Computed: true,
},
"pre_reservations": {
Type: schema.TypeList,
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"account_id": {
Type: schema.TypeInt,
Computed: true,
},
"client_type": {
Type: schema.TypeString,
Computed: true,
},
"domain_name": {
Type: schema.TypeString,
Computed: true,
},
"hostname": {
Type: schema.TypeString,
Computed: true,
},
"desc": {
Type: schema.TypeString,
Computed: true,
},
"ip": {
Type: schema.TypeString,
Computed: true,
},
"mac": {
Type: schema.TypeString,
Computed: true,
},
"type": {
Type: schema.TypeString,
Computed: true,
},
"vm_id": {
Type: schema.TypeInt,
Computed: true,
},
},
},
},
"routes": {
Type: schema.TypeList,
Computed: true,