Skip to content

Commit

Permalink
Auto updated assets for terraform 22.1.5 (#565)
Browse files Browse the repository at this point in the history
* Updated assets for terraform

Signed-off-by: Sagar <[email protected]>

* Updated assets for terraform

Signed-off-by: Sagar <[email protected]>

* Updated assets for terraform

Signed-off-by: Sagar <[email protected]>

* Updated assets for terraform

Signed-off-by: Sagar <[email protected]>

* Re Formated resources

* Updated assets for terraform

Signed-off-by: Sagar <[email protected]>

* Updated assets for terraform

Signed-off-by: Sagar <[email protected]>

* Updated imports
Signed-off-by: Rohan <[email protected]>

* Updated assets for terraform

Signed-off-by: Sagar <[email protected]>

* Updated assets for terraform

Signed-off-by: Sagar <[email protected]>

* Updated assets for terraform

Signed-off-by: Sagar <[email protected]>

* Reformated go files

* Updated Changelog

Signed-off-by: Rohan <[email protected]>

---------

Signed-off-by: Sagar <[email protected]>
Signed-off-by: Rohan <[email protected]>
Co-authored-by: Rohan <[email protected]>
  • Loading branch information
sagarpsalvi and Rohan-sss1 authored Oct 30, 2023
1 parent a51db59 commit 2838665
Show file tree
Hide file tree
Showing 14 changed files with 120 additions and 31 deletions.
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
## 0.3.0 (Unreleased)
## 0.3.1 (Unreleased)
## 0.3.0 (October 30, 2023)
BUG FIXES:
- AV-187301: Entering worng credentials on terraform using AVI as provider while using Plan command break statefile
- AV-187199: AVI terraform apply the resource object even if it is already exist without showing Error.
- AV-186452: AVI-provider for Terraform version 22.1.2 and 22.1.4 creates any object in the Admin tenant.
- AV-186737: Changes to certain subresources are not detected as changes by Terraform

## 0.2.3 (June 16, 2020)
Features:
- Updated Avi Go SDK to latest.
Expand Down
3 changes: 3 additions & 0 deletions avi/data_source_avi_applicationprofile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ resource "avi_applicationprofile" "testApplicationProfile" {
use_app_keepalive_timeout = false
}
preserve_client_port = false
l4_ssl_profile {
ssl_stream_idle_timeout = "3600"
}
}
data "avi_applicationprofile" "testApplicationProfile" {
Expand Down
2 changes: 1 addition & 1 deletion avi/data_source_avi_user_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ data "avi_useraccountprofile" "default-user-account-profile" {
}
resource "avi_user" "testUser" {
access {
role_ref = data.avi_role.default-system-admin-role.id
role_ref = "${data.avi_tenant.default_tenant.id}/role/${element(split("/", data.avi_role.default-system-admin-role.id),5)}"
tenant_ref = data.avi_tenant.default_tenant.id
all_tenants = false
}
Expand Down
8 changes: 8 additions & 0 deletions avi/datasource_avi_controllerproperties.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,18 @@ func dataSourceAviControllerProperties() *schema.Resource {
Type: schema.TypeString,
Computed: true,
},
"cloud_discovery_interval": {
Type: schema.TypeString,
Computed: true,
},
"cloud_reconcile": {
Type: schema.TypeString,
Computed: true,
},
"cloud_reconcile_interval": {
Type: schema.TypeString,
Computed: true,
},
"cluster_ip_gratuitous_arp_period": {
Type: schema.TypeString,
Computed: true,
Expand Down
6 changes: 6 additions & 0 deletions avi/resource_avi_applicationprofile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,9 @@ resource "avi_applicationprofile" "testApplicationProfile" {
use_app_keepalive_timeout = false
}
preserve_client_port = false
l4_ssl_profile {
ssl_stream_idle_timeout = "3600"
}
}
`

Expand Down Expand Up @@ -253,5 +256,8 @@ resource "avi_applicationprofile" "testApplicationProfile" {
use_app_keepalive_timeout = false
}
preserve_client_port = false
l4_ssl_profile {
ssl_stream_idle_timeout = "3600"
}
}
`
24 changes: 14 additions & 10 deletions avi/resource_avi_cloud.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"log"
"os"
"strconv"
"strings"
"time"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
Expand Down Expand Up @@ -335,21 +336,24 @@ func setupVcenterMgmtNetwork(d *schema.ResourceData, meta interface{}) error {
client := meta.(*clients.AviClient)
vcenterConfig, _ := d.GetOk("vcenter_configuration")
mgmtNetwork := vcenterConfig.(*schema.Set).List()[0].(map[string]interface{})["management_network"].(string)
mgmtNetwork = "vimgrruntime?name=" + mgmtNetwork
if err := APICreateOrUpdate(d, meta, "cloud", s); err != nil {
log.Printf("[Error] Got error for cloud create/update. Error: %s", err.Error())
return err
}
uuid := d.Get("uuid").(string)
if err := waitForCloudState(uuid, "CLOUD_STATE_FAILED", client, maxRetry); err != nil {
return err
}
vcenterConfig.(*schema.Set).List()[0].(map[string]interface{})["management_network"] = mgmtNetwork
if err := d.Set("vcenter_configuration", vcenterConfig); err != nil {
return err
}
if err := APICreateOrUpdate(d, meta, "cloud", s); err != nil {
return err
if ok := strings.Contains(mgmtNetwork, "api/"); !ok {
mgmtNetwork = "vimgrruntime?name=" + mgmtNetwork
vcenterConfig.(*schema.Set).List()[0].(map[string]interface{})["management_network"] = mgmtNetwork
if err := d.Set("vcenter_configuration", vcenterConfig); err != nil {
return err
}
if err := waitForCloudState(uuid, "CLOUD_STATE_FAILED", client, maxRetry); err != nil {
return err
}
if err := APICreateOrUpdate(d, meta, "cloud", s); err != nil {
log.Printf("[Error] Got error for cloud create/update. Error: %s", err.Error())
return err
}
}
if err := waitForCloudState(uuid, "CLOUD_STATE_PLACEMENT_READY", client, maxRetry); err != nil {
return err
Expand Down
12 changes: 12 additions & 0 deletions avi/resource_avi_controllerproperties.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,24 @@ func ResourceControllerPropertiesSchema() map[string]*schema.Schema {
Default: "60",
ValidateFunc: validateInteger,
},
"cloud_discovery_interval": {
Type: schema.TypeString,
Optional: true,
Default: "5",
ValidateFunc: validateInteger,
},
"cloud_reconcile": {
Type: schema.TypeString,
Optional: true,
Default: "true",
ValidateFunc: validateBool,
},
"cloud_reconcile_interval": {
Type: schema.TypeString,
Optional: true,
Default: "5",
ValidateFunc: validateInteger,
},
"cluster_ip_gratuitous_arp_period": {
Type: schema.TypeString,
Optional: true,
Expand Down
16 changes: 16 additions & 0 deletions avi/resource_avi_rest_dependants.go
Original file line number Diff line number Diff line change
Expand Up @@ -10097,6 +10097,12 @@ func ResourceDnsServiceApplicationProfileSchema() *schema.Resource {
Optional: true,
Default: "hostmaster",
},
"client_dns_tcp_request_timeout": {
Type: schema.TypeString,
Optional: true,
Default: "10000",
ValidateFunc: validateInteger,
},
"close_tcp_connection_post_response": {
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -32581,12 +32587,22 @@ func ResourceStreamingSyslogConfigSchema() *schema.Resource {
Optional: true,
Default: "AviVantage",
},
"msg_id": {
Type: schema.TypeString,
Optional: true,
Default: "NILVALUE",
},
"non_significant_log_severity": {
Type: schema.TypeString,
Optional: true,
Default: "6",
ValidateFunc: validateInteger,
},
"proc_id": {
Type: schema.TypeString,
Optional: true,
Default: "NILVALUE",
},
"significant_log_severity": {
Type: schema.TypeString,
Optional: true,
Expand Down
4 changes: 2 additions & 2 deletions avi/resource_avi_user_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ data "avi_useraccountprofile" "default-user-account-profile" {
}
resource "avi_user" "testUser" {
access {
role_ref = data.avi_role.default-system-admin-role.id
role_ref = "${data.avi_tenant.default_tenant.id}/role/${element(split("/", data.avi_role.default-system-admin-role.id),5)}"
tenant_ref = data.avi_tenant.default_tenant.id
all_tenants = false
}
Expand Down Expand Up @@ -138,7 +138,7 @@ data "avi_useraccountprofile" "default-user-account-profile" {
}
resource "avi_user" "testUser" {
access {
role_ref = data.avi_role.default-system-admin-role.id
role_ref = "${data.avi_tenant.default_tenant.id}/role/${element(split("/", data.avi_role.default-system-admin-role.id),5)}"
tenant_ref = data.avi_tenant.default_tenant.id
all_tenants = false
}
Expand Down
53 changes: 37 additions & 16 deletions avi/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,6 @@ func APICreateOrUpdate(d *schema.ResourceData, meta interface{}, objType string,
log.Printf("[INFO] APICreateOrUpdate Tenant ref found %v", tenantName)
}
if specialobj {
path = path + "?skip_default=true"
err = client.AviSession.Put(path, data, &robj)
if err != nil {
log.Printf("[ERROR] APICreateOrUpdate: PUT on %v Error %v path %v id %v\n", objType, err, path,
Expand All @@ -316,7 +315,7 @@ func APICreateOrUpdate(d *schema.ResourceData, meta interface{}, objType string,
SetIDFromObj(d, robj)
}
} else if uuid, ok := d.GetOk("uuid"); ok {
path = path + "/" + uuid.(string) + "?skip_default=true"
path = path + "/" + uuid.(string)
if !usePatchForUpdate {
err = client.AviSession.Put(path, data, &robj, session.SetOptTenant(tenantName))
} else {
Expand Down Expand Up @@ -366,7 +365,7 @@ func APICreateOrUpdate(d *schema.ResourceData, meta interface{}, objType string,
// found existing object.
SetIDFromObj(d, existingObj)
uuid = existingObj.(map[string]interface{})["uuid"].(string)
path = path + "/" + uuid.(string) + "?skip_default=true"
path = path + "/" + uuid.(string)
if !usePatchForUpdate {
err = client.AviSession.Put(path, data, &robj)
} else {
Expand Down Expand Up @@ -428,7 +427,7 @@ func APIRead(d *schema.ResourceData, meta interface{}, objType string, s map[str
if specialobj {
path = "api/" + objType
} else {
path = "api/" + objType + "/" + uuid + "?skip_default=true"
path = "api/" + objType + "/" + uuid
}
log.Printf("[DEBUG] APIRead reading object with id %v path %v\n", uuid, path)
err := client.AviSession.Get(path, &obj, session.SetOptTenant(tenantName))
Expand Down Expand Up @@ -470,15 +469,7 @@ func APIRead(d *schema.ResourceData, meta interface{}, objType string, s map[str
log.Printf("[ERROR] APIRead not found %v\n", d.Get("uuid"))
return nil
}
if localData, err := SchemaToAviData(d, s); err == nil {
modAPIRes, err := SetDefaultsInAPIRes(obj, localData, s)
if err != nil {
log.Printf("[ERROR] APIRead in modifying api response object %v\n", err)
}
modAPIRes, err = PreprocessAPIRes(modAPIRes, s)
if err != nil {
log.Printf("[ERROR] APIRead in modifying api response object for conversion %v\n", err)
}
if modAPIRes, err := PreprocessAPIRes(obj, s); err == nil {
if _, err := APIDataToSchema(modAPIRes, d, s); err == nil {
if modAPIRes.(map[string]interface{})["uuid"] != nil {
uuid = modAPIRes.(map[string]interface{})["uuid"].(string)
Expand All @@ -497,10 +488,40 @@ func APIRead(d *schema.ResourceData, meta interface{}, objType string, s map[str
} else {
log.Printf("[ERROR] APIRead in setting read object %v\n", err)
}
log.Printf("[DEBUG] type: %v localData : %v", objType, localData)
log.Printf("[DEBUG] type: %v modAPIRes: %v", objType, modAPIRes)
} else {
log.Printf("[ERROR] APIRead in modifying api response object for conversion %v\n", err)
}

// if localData, err := SchemaToAviData(d, s); err == nil {
// // modAPIRes, err := SetDefaultsInAPIRes(obj, localData, s)
// if err != nil {
// log.Printf("[ERROR] APIRead in modifying api response object %v\n", err)
// }
// modAPIRes, err := PreprocessAPIRes(obj, s)
// if err != nil {
// log.Printf("[ERROR] APIRead in modifying api response object for conversion %v\n", err)
// }
// if _, err := APIDataToSchema(modAPIRes, d, s); err == nil {
// if modAPIRes.(map[string]interface{})["uuid"] != nil {
// uuid = modAPIRes.(map[string]interface{})["uuid"].(string)
// }
// if modAPIRes.(map[string]interface{})["url"] != nil {
// url = modAPIRes.(map[string]interface{})["url"].(string)
// }
// //url = strings.SplitN(url, "#", 2)[0]
// if url != "" {
// d.SetId(url)
// log.Printf("[DEBUG] APIRead read object with id %v\n", url)
// } else {
// d.SetId(uuid)
// log.Printf("[DEBUG] APIRead read object with id %v\n", uuid)
// }
// } else {
// log.Printf("[ERROR] APIRead in setting read object %v\n", err)
// }
// log.Printf("[DEBUG] type: %v localData : %v", objType, localData)
// log.Printf("[DEBUG] type: %v modAPIRes: %v", objType, modAPIRes)
// }
return nil
}

Expand Down Expand Up @@ -540,7 +561,7 @@ func ResourceImporter(d *schema.ResourceData, meta interface{}, objType string,
}
var data interface{}
client := meta.(*clients.AviClient)
path := "api/" + objType + "?skip_default=true"
path := "api/" + objType
err := client.AviSession.Get(path, &data)
if err != nil {
log.Printf("[ERROR] ResourceImporter %v in GET of path %v\n", err, path)
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ go 1.16

require (
github.com/hashicorp/terraform-plugin-sdk/v2 v2.20.0
github.com/vmware/alb-sdk v0.0.0-20230803045343-7e6a018c41ca
github.com/vmware/alb-sdk v0.0.0-20231017102949-55cd29c1dd76
)
8 changes: 8 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,14 @@ github.com/vmware/alb-sdk v0.0.0-20230628113843-5165d78773eb h1:fD8NF+e7YEeiE/6O
github.com/vmware/alb-sdk v0.0.0-20230628113843-5165d78773eb/go.mod h1:fuRb4saDY/xy/UMeMvyKYmcplNknEL9ysaqYSw7reNE=
github.com/vmware/alb-sdk v0.0.0-20230803045343-7e6a018c41ca h1:R8cugWJDNvrC00LEgCN0Kr4Mgb58vw/fy3WtsTfL5Do=
github.com/vmware/alb-sdk v0.0.0-20230803045343-7e6a018c41ca/go.mod h1:fuRb4saDY/xy/UMeMvyKYmcplNknEL9ysaqYSw7reNE=
github.com/vmware/alb-sdk v0.0.0-20230925090656-d3e38a2158c3 h1:2aGDS770QDZFBqpZhqhpmW6z8+ekNhN2A1gKDszOL7I=
github.com/vmware/alb-sdk v0.0.0-20230925090656-d3e38a2158c3/go.mod h1:fuRb4saDY/xy/UMeMvyKYmcplNknEL9ysaqYSw7reNE=
github.com/vmware/alb-sdk v0.0.0-20230929065435-97937a02f61c h1:c0rLp5vieq0pfYlftKnMkjreudKTDrAMKlg2GMgnEgU=
github.com/vmware/alb-sdk v0.0.0-20230929065435-97937a02f61c/go.mod h1:fuRb4saDY/xy/UMeMvyKYmcplNknEL9ysaqYSw7reNE=
github.com/vmware/alb-sdk v0.0.0-20230929130736-eaca7e5d3e68 h1:4XEOrWr70fSwI3jLNyrMy4OWvpG2d5IDNEi4z3r+/ME=
github.com/vmware/alb-sdk v0.0.0-20230929130736-eaca7e5d3e68/go.mod h1:fuRb4saDY/xy/UMeMvyKYmcplNknEL9ysaqYSw7reNE=
github.com/vmware/alb-sdk v0.0.0-20231017102949-55cd29c1dd76 h1:O5uFlHpps0NESmls1wY5Eai+Pt41TGt1VCFjjmJ74N0=
github.com/vmware/alb-sdk v0.0.0-20231017102949-55cd29c1dd76/go.mod h1:fuRb4saDY/xy/UMeMvyKYmcplNknEL9ysaqYSw7reNE=
github.com/xanzy/ssh-agent v0.3.0 h1:wUMzuKtKilRgBAD1sUb8gOwwRr2FGoBVumcjoOACClI=
github.com/xanzy/ssh-agent v0.3.0/go.mod h1:3s9xbODqPuuhK9JV1R321M/FlMZSBvE5aY6eAcqrDh0=
github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
Expand Down
2 changes: 2 additions & 0 deletions website/docs/d/avi_controllerproperties.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ In addition to all arguments above, the following attributes are exported:
* `check_vsvip_fqdn_syntax` - Enforce vsvip fqdn syntax checks. Field introduced in 20.1.6. Allowed in enterprise edition with any value, essentials edition with any value, basic edition with any value, enterprise with cloud services edition.
* `cleanup_expired_authtoken_timeout_period` - Period for auth token cleanup job. Field introduced in 18.1.1. Unit is min. Allowed in enterprise edition with any value, essentials, basic, enterprise with cloud services edition.
* `cleanup_sessions_timeout_period` - Period for sessions cleanup job. Field introduced in 18.1.1. Unit is min. Allowed in enterprise edition with any value, essentials, basic, enterprise with cloud services edition.
* `cloud_discovery_interval` - Time in minutes to wait between consecutive cloud discovery cycles. Allowed values are 1-1440. Field introduced in 22.1.5. Unit is min. Allowed in enterprise edition with any value, enterprise with cloud services edition.
* `cloud_reconcile` - Enable/disable periodic reconcile for all the clouds. Field introduced in 17.2.14,18.1.5,18.2.1. Allowed in enterprise edition with any value, essentials, basic, enterprise with cloud services edition.
* `cloud_reconcile_interval` - Time in minutes to wait between consecutive cloud reconcile cycles. Allowed values are 1-1440. Field introduced in 22.1.5. Unit is min. Allowed in enterprise edition with any value, enterprise with cloud services edition.
* `cluster_ip_gratuitous_arp_period` - Period for cluster ip gratuitous arp job. Unit is min. Allowed in enterprise edition with any value, essentials, basic, enterprise with cloud services edition.
* `configpb_attributes` - Protobuf versioning for config pbs. Field introduced in 21.1.1. Allowed in enterprise edition with any value, essentials edition with any value, basic edition with any value, enterprise with cloud services edition.
* `consistency_check_timeout_period` - Period for consistency check job. Field introduced in 18.1.1. Unit is min. Allowed in enterprise edition with any value, essentials, basic, enterprise with cloud services edition.
Expand Down
2 changes: 2 additions & 0 deletions website/docs/r/avi_controllerproperties.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ The following arguments are supported:
* `check_vsvip_fqdn_syntax` - (Optional) Enforce vsvip fqdn syntax checks. Field introduced in 20.1.6. Allowed in enterprise edition with any value, essentials edition with any value, basic edition with any value, enterprise with cloud services edition.
* `cleanup_expired_authtoken_timeout_period` - (Optional) Period for auth token cleanup job. Field introduced in 18.1.1. Unit is min. Allowed in enterprise edition with any value, essentials, basic, enterprise with cloud services edition.
* `cleanup_sessions_timeout_period` - (Optional) Period for sessions cleanup job. Field introduced in 18.1.1. Unit is min. Allowed in enterprise edition with any value, essentials, basic, enterprise with cloud services edition.
* `cloud_discovery_interval` - (Optional) Time in minutes to wait between consecutive cloud discovery cycles. Allowed values are 1-1440. Field introduced in 22.1.5. Unit is min. Allowed in enterprise edition with any value, enterprise with cloud services edition.
* `cloud_reconcile` - (Optional) Enable/disable periodic reconcile for all the clouds. Field introduced in 17.2.14,18.1.5,18.2.1. Allowed in enterprise edition with any value, essentials, basic, enterprise with cloud services edition.
* `cloud_reconcile_interval` - (Optional) Time in minutes to wait between consecutive cloud reconcile cycles. Allowed values are 1-1440. Field introduced in 22.1.5. Unit is min. Allowed in enterprise edition with any value, enterprise with cloud services edition.
* `cluster_ip_gratuitous_arp_period` - (Optional) Period for cluster ip gratuitous arp job. Unit is min. Allowed in enterprise edition with any value, essentials, basic, enterprise with cloud services edition.
* `configpb_attributes` - (Optional) Protobuf versioning for config pbs. Field introduced in 21.1.1. Allowed in enterprise edition with any value, essentials edition with any value, basic edition with any value, enterprise with cloud services edition.
* `consistency_check_timeout_period` - (Optional) Period for consistency check job. Field introduced in 18.1.1. Unit is min. Allowed in enterprise edition with any value, essentials, basic, enterprise with cloud services edition.
Expand Down

0 comments on commit 2838665

Please sign in to comment.