diff --git a/Makefile b/Makefile index aa7d181..3408c3e 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ HOSTNAME=registry.terraform.io NAMESPACE=netrisai NAME=netris BINARY=terraform-provider-${NAME} -VERSION=3.5.3 +VERSION=3.5.4 OS_ARCH=darwin_arm64 WORKDIRECTORY=examples diff --git a/docs/resources/vnet.md b/docs/resources/vnet.md index 2359433..50a9d70 100644 --- a/docs/resources/vnet.md +++ b/docs/resources/vnet.md @@ -73,6 +73,7 @@ resource "netris_vnet" "my-vnet" { - **tags** (List of String) List of tags. Example `["foo", "bar"]` - **vlanid** (String) VLAN tag for all network interfaces of the vnet. Also can be `auto`. If set `auto` the controller will assign a vlan ID automatically. - **vpcid** (Number) ID of VPC. If not specified, the vnet will be created in the VPC marked as a default. +- **vxlanid** (Number) VXLAN ID. If not specified will be generated automatically. ### Nested Schema for `sites` diff --git a/examples/user_example.tf b/examples/user_example.tf index f657afb..d3219a1 100644 --- a/examples/user_example.tf +++ b/examples/user_example.tf @@ -1,8 +1,8 @@ resource "netris_user" "terrraform-user" { username = "terraform" fullname = "Terraform" - email = "terraform@netris.ai" - emailcc = "devops@netris.ai" + email = "terraform@netris.local" + emailcc = "devops@netris.local" phone = "6504570097" company = "Netris, Inc." position = "DevOps Engineer" diff --git a/examples/vnet_example.tf b/examples/vnet_example.tf index 693c2dd..2f4d214 100644 --- a/examples/vnet_example.tf +++ b/examples/vnet_example.tf @@ -37,6 +37,7 @@ resource "netris_vnet" "my-vnet-in-my-vpc" { state = "active" # tags = ["foo", "bar"] vpcid = netris_vpc.my-vpc.id + vxlanid = 456 sites { id = netris_site.santa-clara.id gateways { diff --git a/go.mod b/go.mod index 598e26e..b63f563 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.20 require ( github.com/hashicorp/terraform-plugin-sdk v1.17.2 - github.com/netrisai/netriswebapi v0.0.0-20240913184109-c0bcbba3f0e7 + github.com/netrisai/netriswebapi v0.0.0-20241024153234-15244ba023d1 ) diff --git a/go.sum b/go.sum index 6991ab0..dbbcee3 100644 --- a/go.sum +++ b/go.sum @@ -422,6 +422,8 @@ github.com/netrisai/netriswebapi v0.0.0-20240911011151-253cf19362ec h1:DR66G/+tu github.com/netrisai/netriswebapi v0.0.0-20240911011151-253cf19362ec/go.mod h1:GLLz33Jc07/hIPwEYZDWEtNtHjX/QZjVzf9xLnfSiqs= github.com/netrisai/netriswebapi v0.0.0-20240913184109-c0bcbba3f0e7 h1:9NX6gU384jtOJA8Zky+azUDmJKHBz8M0cxpLgKlIfRc= github.com/netrisai/netriswebapi v0.0.0-20240913184109-c0bcbba3f0e7/go.mod h1:GLLz33Jc07/hIPwEYZDWEtNtHjX/QZjVzf9xLnfSiqs= +github.com/netrisai/netriswebapi v0.0.0-20241024153234-15244ba023d1 h1:U0AqqJ7je8rQ/Oryhw+j9ieTI9RgHURYjwOe7D6Wgmc= +github.com/netrisai/netriswebapi v0.0.0-20241024153234-15244ba023d1/go.mod h1:GLLz33Jc07/hIPwEYZDWEtNtHjX/QZjVzf9xLnfSiqs= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= github.com/oklog/run v1.1.0 h1:GEenZ1cK0+q0+wsJew9qUg/DyD8k3JzYsZAi5gYi2mA= diff --git a/netris/vnet/vnet.go b/netris/vnet/vnet.go index 6debc70..b3c0e99 100644 --- a/netris/vnet/vnet.go +++ b/netris/vnet/vnet.go @@ -209,6 +209,12 @@ func Resource() *schema.Resource { Type: schema.TypeInt, Description: "ID of VPC. If not specified, the V-Net will be created in the VPC marked as a default.", }, + "vxlanid": { + Optional: true, + Computed: true, + Type: schema.TypeInt, + Description: "VXLAN ID. If not specified will be generated automatically.", + }, }, Create: resourceCreate, Read: resourceRead, @@ -243,6 +249,7 @@ func resourceCreate(d *schema.ResourceData, m interface{}) error { tagsList := d.Get("tags").(*schema.Set).List() vpcid := d.Get("vpcid").(int) + vxlanid := d.Get("vxlanid").(int) tags := []string{} for _, tag := range tagsList { tags = append(tags, tag.(string)) @@ -353,6 +360,7 @@ func resourceCreate(d *schema.ResourceData, m interface{}) error { Ports: members, Vlan: vlanidInterface, Tags: tags, + VxlanID: vxlanid, } if vpcid > 0 { @@ -600,6 +608,11 @@ func resourceRead(d *schema.ResourceData, m interface{}) error { return err } + err = d.Set("vxlanid", vnetresp.VxlanID) + if err != nil { + return err + } + if currentVpcId > 0 { err = d.Set("vpcid", vnetresp.Vpc.ID) if err != nil { @@ -616,6 +629,7 @@ func resourceUpdate(d *schema.ResourceData, m interface{}) error { sites := d.Get("sites").([]interface{}) vlanid := d.Get("vlanid").(string) vnetTypeOne := false + vxlanid := d.Get("vxlanid").(int) var sitesList []map[string]interface{} for _, site := range sites { @@ -784,6 +798,7 @@ func resourceUpdate(d *schema.ResourceData, m interface{}) error { Ports: members, Vlan: vlanidInterface, Tags: tags, + VxlanID: vxlanid, } js, _ := json.Marshal(vnetUpdate)