Skip to content

Commit

Permalink
Merge pull request #52 from terraform-providers/revert-49-AV-79877-re…
Browse files Browse the repository at this point in the history
…base

Revert "Av 79877 Updated terraforn provider from 18.2.8"
  • Loading branch information
Gaurav Rastogi authored Mar 29, 2020
2 parents 2f89df2 + b36c677 commit 2f08f15
Show file tree
Hide file tree
Showing 120 changed files with 11,489 additions and 4,906 deletions.
6 changes: 4 additions & 2 deletions avi/data_source_avi_applicationprofile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,14 @@ resource "avi_applicationprofile" "testApplicationProfile" {
keepalive_timeout = "30000"
ssl_client_certificate_mode = "SSL_CLIENT_CERTIFICATE_NONE"
http_to_https = true
spdy_enabled = false
respond_with_100_continue = true
client_body_timeout = "30000"
httponly_enabled = true
hsts_max_age = "365"
max_bad_rps_cip = "0"
server_side_redirect_to_https = true
client_max_header_size = "12"
server_side_redirect_to_https = true
max_bad_rps_cip = "0"
client_max_request_size = "48"
cache_config {
min_object_size = "100"
Expand All @@ -83,6 +84,7 @@ resource "avi_applicationprofile" "testApplicationProfile" {
mime_types_group_refs = [data.avi_stringgroup.system_cacheablestringgroup.id]
}
max_rps_unknown_uri = "0"
spdy_fwd_proxy_mode = false
allow_dots_in_header_name = false
client_header_timeout = "10000"
post_accept_timeout = "30000"
Expand Down
4 changes: 0 additions & 4 deletions avi/datasource_avi_healthmonitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ func dataSourceAviHealthMonitor() *schema.Resource {
return &schema.Resource{
Read: ResourceAviHealthMonitorRead,
Schema: map[string]*schema.Schema{
"allow_duplicate_monitors": {
Type: schema.TypeBool,
Computed: true,
},
"description": {
Type: schema.TypeString,
Computed: true,
Expand Down
12 changes: 0 additions & 12 deletions avi/datasource_avi_image.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ func dataSourceAviImage() *schema.Resource {
Computed: true,
Elem: ResourcePackageDetailsSchema(),
},
"controller_patch_uuid": {
Type: schema.TypeString,
Computed: true,
},
"migrations": {
Type: schema.TypeSet,
Computed: true,
Expand All @@ -35,10 +31,6 @@ func dataSourceAviImage() *schema.Resource {
Computed: true,
Elem: ResourcePackageDetailsSchema(),
},
"se_patch_uuid": {
Type: schema.TypeString,
Computed: true,
},
"status": {
Type: schema.TypeString,
Computed: true,
Expand All @@ -52,10 +44,6 @@ func dataSourceAviImage() *schema.Resource {
Type: schema.TypeString,
Computed: true,
},
"uber_bundle": {
Type: schema.TypeBool,
Computed: true,
},
"uuid": {
Type: schema.TypeString,
Optional: true,
Expand Down
16 changes: 0 additions & 16 deletions avi/datasource_avi_serviceenginegroup.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,6 @@ func dataSourceAviServiceEngineGroup() *schema.Resource {
Type: schema.TypeInt,
Computed: true,
},
"core_shm_app_cache": {
Type: schema.TypeBool,
Computed: true,
},
"core_shm_app_learning": {
Type: schema.TypeBool,
Computed: true,
},
"cpu_reserve": {
Type: schema.TypeBool,
Computed: true,
Expand Down Expand Up @@ -401,10 +393,6 @@ func dataSourceAviServiceEngineGroup() *schema.Resource {
Type: schema.TypeInt,
Computed: true,
},
"pcap_tx_mode": {
Type: schema.TypeString,
Computed: true,
},
"per_app": {
Type: schema.TypeBool,
Computed: true,
Expand Down Expand Up @@ -479,10 +467,6 @@ func dataSourceAviServiceEngineGroup() *schema.Resource {
Type: schema.TypeBool,
Computed: true,
},
"se_mtu": {
Type: schema.TypeInt,
Computed: true,
},
"se_name_prefix": {
Type: schema.TypeString,
Computed: true,
Expand Down
4 changes: 0 additions & 4 deletions avi/datasource_avi_stringgroup.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@ func dataSourceAviStringGroup() *schema.Resource {
Computed: true,
Elem: ResourceKeyValueSchema(),
},
"longest_match": {
Type: schema.TypeBool,
Computed: true,
},
"name": {
Type: schema.TypeString,
Optional: true,
Expand Down
14 changes: 0 additions & 14 deletions avi/datasource_avi_upgradestatusinfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,6 @@ func dataSourceAviUpgradeStatusInfo() *schema.Resource {
Type: schema.TypeString,
Computed: true,
},
"patch_list": {
Type: schema.TypeList,
Computed: true,
Elem: ResourcePatchDataSchema(),
},
"patch_version": {
Type: schema.TypeString,
Computed: true,
Expand All @@ -74,11 +69,6 @@ func dataSourceAviUpgradeStatusInfo() *schema.Resource {
Type: schema.TypeString,
Computed: true,
},
"previous_patch_list": {
Type: schema.TypeList,
Computed: true,
Elem: ResourcePatchDataSchema(),
},
"previous_patch_version": {
Type: schema.TypeString,
Computed: true,
Expand All @@ -87,10 +77,6 @@ func dataSourceAviUpgradeStatusInfo() *schema.Resource {
Type: schema.TypeString,
Computed: true,
},
"progress": {
Type: schema.TypeInt,
Computed: true,
},
"se_upgrade_events": {
Type: schema.TypeList,
Computed: true,
Expand Down
31 changes: 25 additions & 6 deletions avi/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
package avi

import (
"fmt"
"github.com/avinetworks/sdk/go/clients"
"github.com/avinetworks/sdk/go/session"
"github.com/hashicorp/go-multierror"
"github.com/hashicorp/terraform/helper/schema"
"github.com/hashicorp/terraform/terraform"
"log"
Expand Down Expand Up @@ -80,10 +82,10 @@ func Provider() terraform.ResourceProvider {
"avi_l4policyset": dataSourceAviL4PolicySet(),
"avi_scheduler": dataSourceAviScheduler(),
"avi_backupconfiguration": dataSourceAviBackupConfiguration(),
"avi_tenant": dataSourceAviTenant(),
"avi_serviceenginegroup": dataSourceAviServiceEngineGroup(),
"avi_networkservice": dataSourceAviNetworkService(),
"avi_dnspolicy": dataSourceAviDnsPolicy(),
"avi_tenant": dataSourceAviTenant(),
"avi_hardwaresecuritymodulegroup": dataSourceAviHardwareSecurityModuleGroup(),
"avi_upgradestatussummary": dataSourceAviUpgradeStatusSummary(),
"avi_upgradestatusinfo": dataSourceAviUpgradeStatusInfo(),
Expand Down Expand Up @@ -116,7 +118,7 @@ func Provider() terraform.ResourceProvider {
"avi_errorpageprofile": dataSourceAviErrorPageProfile(),
"avi_customerportalinfo": dataSourceAviCustomerPortalInfo(),
"avi_controllerproperties": dataSourceAviControllerProperties(),
"avi_healthmonitor": dataSourceAviHealthMonitor(),
"avi_applicationprofile": dataSourceAviApplicationProfile(),
"avi_virtualservice": dataSourceAviVirtualService(),
"avi_vsvip": dataSourceAviVsVip(),
"avi_analyticsprofile": dataSourceAviAnalyticsProfile(),
Expand All @@ -139,7 +141,7 @@ func Provider() terraform.ResourceProvider {
"avi_network": dataSourceAviNetwork(),
"avi_serverautoscalepolicy": dataSourceAviServerAutoScalePolicy(),
"avi_autoscalelaunchconfig": dataSourceAviAutoScaleLaunchConfig(),
"avi_applicationprofile": dataSourceAviApplicationProfile(),
"avi_healthmonitor": dataSourceAviHealthMonitor(),
"avi_httppolicyset": dataSourceAviHTTPPolicySet(),
"avi_serviceengine": dataSourceAviServiceEngine(),
"avi_fileservice": dataSourceAviFileService(),
Expand All @@ -165,10 +167,10 @@ func Provider() terraform.ResourceProvider {
"avi_l4policyset": resourceAviL4PolicySet(),
"avi_scheduler": resourceAviScheduler(),
"avi_backupconfiguration": resourceAviBackupConfiguration(),
"avi_tenant": resourceAviTenant(),
"avi_serviceenginegroup": resourceAviServiceEngineGroup(),
"avi_networkservice": resourceAviNetworkService(),
"avi_dnspolicy": resourceAviDnsPolicy(),
"avi_tenant": resourceAviTenant(),
"avi_hardwaresecuritymodulegroup": resourceAviHardwareSecurityModuleGroup(),
"avi_upgradestatussummary": resourceAviUpgradeStatusSummary(),
"avi_upgradestatusinfo": resourceAviUpgradeStatusInfo(),
Expand Down Expand Up @@ -201,7 +203,7 @@ func Provider() terraform.ResourceProvider {
"avi_errorpageprofile": resourceAviErrorPageProfile(),
"avi_customerportalinfo": resourceAviCustomerPortalInfo(),
"avi_controllerproperties": resourceAviControllerProperties(),
"avi_healthmonitor": resourceAviHealthMonitor(),
"avi_applicationprofile": resourceAviApplicationProfile(),
"avi_virtualservice": resourceAviVirtualService(),
"avi_vsvip": resourceAviVsVip(),
"avi_analyticsprofile": resourceAviAnalyticsProfile(),
Expand All @@ -224,7 +226,7 @@ func Provider() terraform.ResourceProvider {
"avi_network": resourceAviNetwork(),
"avi_serverautoscalepolicy": resourceAviServerAutoScalePolicy(),
"avi_autoscalelaunchconfig": resourceAviAutoScaleLaunchConfig(),
"avi_applicationprofile": resourceAviApplicationProfile(),
"avi_healthmonitor": resourceAviHealthMonitor(),
"avi_httppolicyset": resourceAviHTTPPolicySet(),
"avi_serviceengine": resourceAviServiceEngine(),
"avi_useraccount": resourceAviUserAccount(),
Expand Down Expand Up @@ -260,6 +262,10 @@ func providerConfigure(d *schema.ResourceData) (interface{}, error) {
config.Timeout = time.Duration(time.Duration(timeout.(int)) * time.Second)
}

if err := config.validate(); err != nil {
return nil, err
}

aviClient, err := clients.NewAviClient(
config.Controller, config.Username,
session.SetPassword(config.Password),
Expand All @@ -284,3 +290,16 @@ type Credentials struct {
AuthToken string
Timeout time.Duration
}

func (c *Credentials) validate() error {
var err *multierror.Error

if c.Controller == "" {
err = multierror.Append(err, fmt.Errorf("Avi Controller must be provided"))
}

if c.Password == "" && c.AuthToken == "" {
err = multierror.Append(err, fmt.Errorf("Avi Controller password or authtoken must be provided"))
}
return err.ErrorOrNil()
}
12 changes: 8 additions & 4 deletions avi/resource_avi_applicationprofile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,14 @@ resource "avi_applicationprofile" "testApplicationProfile" {
keepalive_timeout = "30000"
ssl_client_certificate_mode = "SSL_CLIENT_CERTIFICATE_NONE"
http_to_https = true
spdy_enabled = false
respond_with_100_continue = true
client_body_timeout = "30000"
httponly_enabled = true
hsts_max_age = "365"
max_bad_rps_cip = "0"
server_side_redirect_to_https = true
client_max_header_size = "12"
server_side_redirect_to_https = true
max_bad_rps_cip = "0"
client_max_request_size = "48"
cache_config {
min_object_size = "100"
Expand All @@ -154,6 +155,7 @@ resource "avi_applicationprofile" "testApplicationProfile" {
mime_types_group_refs = [data.avi_stringgroup.system_cacheablestringgroup.id]
}
max_rps_unknown_uri = "0"
spdy_fwd_proxy_mode = false
allow_dots_in_header_name = false
client_header_timeout = "10000"
post_accept_timeout = "30000"
Expand Down Expand Up @@ -206,13 +208,14 @@ resource "avi_applicationprofile" "testApplicationProfile" {
keepalive_timeout = "30000"
ssl_client_certificate_mode = "SSL_CLIENT_CERTIFICATE_NONE"
http_to_https = true
spdy_enabled = false
respond_with_100_continue = true
client_body_timeout = "30000"
httponly_enabled = true
hsts_max_age = "365"
max_bad_rps_cip = "0"
server_side_redirect_to_https = true
client_max_header_size = "12"
server_side_redirect_to_https = true
max_bad_rps_cip = "0"
client_max_request_size = "48"
cache_config {
min_object_size = "100"
Expand All @@ -229,6 +232,7 @@ resource "avi_applicationprofile" "testApplicationProfile" {
mime_types_group_refs = [data.avi_stringgroup.system_cacheablestringgroup.id]
}
max_rps_unknown_uri = "0"
spdy_fwd_proxy_mode = false
allow_dots_in_header_name = false
client_header_timeout = "10000"
post_accept_timeout = "30000"
Expand Down
5 changes: 0 additions & 5 deletions avi/resource_avi_healthmonitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@ import (

func ResourceHealthMonitorSchema() map[string]*schema.Schema {
return map[string]*schema.Schema{
"allow_duplicate_monitors": {
Type: schema.TypeBool,
Optional: true,
Computed: true,
},
"description": {
Type: schema.TypeString,
Optional: true,
Expand Down
15 changes: 0 additions & 15 deletions avi/resource_avi_image.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@ func ResourceImageSchema() map[string]*schema.Schema {
Computed: true,
Elem: ResourcePackageDetailsSchema(),
},
"controller_patch_uuid": {
Type: schema.TypeString,
Optional: true,
Computed: true,
},
"migrations": {
Type: schema.TypeSet,
Optional: true,
Expand All @@ -42,11 +37,6 @@ func ResourceImageSchema() map[string]*schema.Schema {
Computed: true,
Elem: ResourcePackageDetailsSchema(),
},
"se_patch_uuid": {
Type: schema.TypeString,
Optional: true,
Computed: true,
},
"status": {
Type: schema.TypeString,
Optional: true,
Expand All @@ -62,11 +52,6 @@ func ResourceImageSchema() map[string]*schema.Schema {
Optional: true,
Computed: true,
},
"uber_bundle": {
Type: schema.TypeBool,
Optional: true,
Default: false,
},
"uuid": {
Type: schema.TypeString,
Optional: true,
Expand Down
Loading

0 comments on commit 2f08f15

Please sign in to comment.