Skip to content

Commit

Permalink
Release v3.5.3 (#41)
Browse files Browse the repository at this point in the history
New Features:

- Added `vxlanid` argument in the `netris_vnet` resource
  • Loading branch information
pogossian authored Oct 24, 2024
1 parent 6a30fe5 commit 9e21ece
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions docs/resources/vnet.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

<a id="nestedblock--sites"></a>
### Nested Schema for `sites`
Expand Down
4 changes: 2 additions & 2 deletions examples/user_example.tf
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
1 change: 1 addition & 0 deletions examples/vnet_example.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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

)

Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
15 changes: 15 additions & 0 deletions netris/vnet/vnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -353,6 +360,7 @@ func resourceCreate(d *schema.ResourceData, m interface{}) error {
Ports: members,
Vlan: vlanidInterface,
Tags: tags,
VxlanID: vxlanid,
}

if vpcid > 0 {
Expand Down Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down Expand Up @@ -784,6 +798,7 @@ func resourceUpdate(d *schema.ResourceData, m interface{}) error {
Ports: members,
Vlan: vlanidInterface,
Tags: tags,
VxlanID: vxlanid,
}

js, _ := json.Marshal(vnetUpdate)
Expand Down

0 comments on commit 9e21ece

Please sign in to comment.