From 2838665e80bbae8be7e87e15364baa132f9a529a Mon Sep 17 00:00:00 2001 From: Sagar Salvi Date: Mon, 30 Oct 2023 14:07:34 +0530 Subject: [PATCH] Auto updated assets for terraform 22.1.5 (#565) * Updated assets for terraform Signed-off-by: Sagar * Updated assets for terraform Signed-off-by: Sagar * Updated assets for terraform Signed-off-by: Sagar * Updated assets for terraform Signed-off-by: Sagar * Re Formated resources * Updated assets for terraform Signed-off-by: Sagar * Updated assets for terraform Signed-off-by: Sagar * Updated imports Signed-off-by: Rohan * Updated assets for terraform Signed-off-by: Sagar * Updated assets for terraform Signed-off-by: Sagar * Updated assets for terraform Signed-off-by: Sagar * Reformated go files * Updated Changelog Signed-off-by: Rohan --------- Signed-off-by: Sagar Signed-off-by: Rohan Co-authored-by: Rohan --- CHANGELOG.md | 9 +++- ...data_source_avi_applicationprofile_test.go | 3 ++ avi/data_source_avi_user_test.go | 2 +- avi/datasource_avi_controllerproperties.go | 8 +++ avi/resource_avi_applicationprofile_test.go | 6 +++ avi/resource_avi_cloud.go | 24 +++++---- avi/resource_avi_controllerproperties.go | 12 +++++ avi/resource_avi_rest_dependants.go | 16 ++++++ avi/resource_avi_user_test.go | 4 +- avi/utils.go | 53 +++++++++++++------ go.mod | 2 +- go.sum | 8 +++ .../d/avi_controllerproperties.html.markdown | 2 + .../r/avi_controllerproperties.html.markdown | 2 + 14 files changed, 120 insertions(+), 31 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e0b14c18e..4c2bf2531 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. diff --git a/avi/data_source_avi_applicationprofile_test.go b/avi/data_source_avi_applicationprofile_test.go index afc35b981..951e0096d 100644 --- a/avi/data_source_avi_applicationprofile_test.go +++ b/avi/data_source_avi_applicationprofile_test.go @@ -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" { diff --git a/avi/data_source_avi_user_test.go b/avi/data_source_avi_user_test.go index a5c13c3fa..a87fa3146 100644 --- a/avi/data_source_avi_user_test.go +++ b/avi/data_source_avi_user_test.go @@ -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 } diff --git a/avi/datasource_avi_controllerproperties.go b/avi/datasource_avi_controllerproperties.go index 603d86152..ea3422503 100644 --- a/avi/datasource_avi_controllerproperties.go +++ b/avi/datasource_avi_controllerproperties.go @@ -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, diff --git a/avi/resource_avi_applicationprofile_test.go b/avi/resource_avi_applicationprofile_test.go index 1afdd7f41..e4f68368c 100644 --- a/avi/resource_avi_applicationprofile_test.go +++ b/avi/resource_avi_applicationprofile_test.go @@ -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" + } } ` @@ -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" + } } ` diff --git a/avi/resource_avi_cloud.go b/avi/resource_avi_cloud.go index 32adfd83f..3bcae5c8f 100644 --- a/avi/resource_avi_cloud.go +++ b/avi/resource_avi_cloud.go @@ -9,6 +9,7 @@ import ( "log" "os" "strconv" + "strings" "time" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" @@ -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 diff --git a/avi/resource_avi_controllerproperties.go b/avi/resource_avi_controllerproperties.go index 46cb6c994..24b7953b9 100644 --- a/avi/resource_avi_controllerproperties.go +++ b/avi/resource_avi_controllerproperties.go @@ -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, diff --git a/avi/resource_avi_rest_dependants.go b/avi/resource_avi_rest_dependants.go index 766354258..e4d95e751 100644 --- a/avi/resource_avi_rest_dependants.go +++ b/avi/resource_avi_rest_dependants.go @@ -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, @@ -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, diff --git a/avi/resource_avi_user_test.go b/avi/resource_avi_user_test.go index 655cb361e..098153fdc 100644 --- a/avi/resource_avi_user_test.go +++ b/avi/resource_avi_user_test.go @@ -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 } @@ -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 } diff --git a/avi/utils.go b/avi/utils.go index 3895cdf77..7ed3c115f 100644 --- a/avi/utils.go +++ b/avi/utils.go @@ -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, @@ -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 { @@ -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 { @@ -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)) @@ -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) @@ -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 } @@ -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) diff --git a/go.mod b/go.mod index f6703bba7..8db87adea 100644 --- a/go.mod +++ b/go.mod @@ -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 ) diff --git a/go.sum b/go.sum index 458c883c3..1bceb66a6 100644 --- a/go.sum +++ b/go.sum @@ -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= diff --git a/website/docs/d/avi_controllerproperties.html.markdown b/website/docs/d/avi_controllerproperties.html.markdown index 8cf6140fc..042a7bf3b 100644 --- a/website/docs/d/avi_controllerproperties.html.markdown +++ b/website/docs/d/avi_controllerproperties.html.markdown @@ -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. diff --git a/website/docs/r/avi_controllerproperties.html.markdown b/website/docs/r/avi_controllerproperties.html.markdown index bd8fb68d1..0d621a23a 100644 --- a/website/docs/r/avi_controllerproperties.html.markdown +++ b/website/docs/r/avi_controllerproperties.html.markdown @@ -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.