From 9cce8530dc64433b034ff11c41e5605cc4e3d571 Mon Sep 17 00:00:00 2001 From: Robert Lippens Date: Sat, 23 Mar 2019 21:12:09 -0700 Subject: [PATCH 1/5] dfs, web endpoints, file secondary endpoint --- azurerm/data_source_storage_account.go | 50 ++++++++ azurerm/resource_arm_storage_account.go | 125 ++++++++++++++++++- website/docs/d/storage_account.html.markdown | 20 +++ website/docs/r/storage_account.html.markdown | 20 +++ 4 files changed, 214 insertions(+), 1 deletion(-) diff --git a/azurerm/data_source_storage_account.go b/azurerm/data_source_storage_account.go index 396cde8bdde7..830f110cf58a 100644 --- a/azurerm/data_source_storage_account.go +++ b/azurerm/data_source_storage_account.go @@ -151,6 +151,46 @@ func dataSourceArmStorageAccount() *schema.Resource { Computed: true, }, + "primary_web_endpoint": { + Type: schema.TypeString, + Computed: true, + }, + + "primary_web_host": { + Type: schema.TypeString, + Computed: true, + }, + + "secondary_web_endpoint": { + Type: schema.TypeString, + Computed: true, + }, + + "secondary_web_host": { + Type: schema.TypeString, + Computed: true, + }, + + "primary_dfs_endpoint": { + Type: schema.TypeString, + Computed: true, + }, + + "primary_dfs_host": { + Type: schema.TypeString, + Computed: true, + }, + + "secondary_dfs_endpoint": { + Type: schema.TypeString, + Computed: true, + }, + + "secondary_dfs_host": { + Type: schema.TypeString, + Computed: true, + }, + // NOTE: The API does not appear to expose a secondary file endpoint "primary_file_endpoint": { Type: schema.TypeString, @@ -162,6 +202,16 @@ func dataSourceArmStorageAccount() *schema.Resource { Computed: true, }, + "secondary_file_endpoint": { + Type: schema.TypeString, + Computed: true, + }, + + "secondary_file_host": { + Type: schema.TypeString, + Computed: true, + }, + "primary_access_key": { Type: schema.TypeString, Computed: true, diff --git a/azurerm/resource_arm_storage_account.go b/azurerm/resource_arm_storage_account.go index 012ccf98cdf7..eb0222ff577f 100644 --- a/azurerm/resource_arm_storage_account.go +++ b/azurerm/resource_arm_storage_account.go @@ -259,7 +259,46 @@ func resourceArmStorageAccount() *schema.Resource { Computed: true, }, - // NOTE: The API does not appear to expose a secondary file endpoint + "primary_web_endpoint": { + Type: schema.TypeString, + Computed: true, + }, + + "primary_web_host": { + Type: schema.TypeString, + Computed: true, + }, + + "secondary_web_endpoint": { + Type: schema.TypeString, + Computed: true, + }, + + "secondary_web_host": { + Type: schema.TypeString, + Computed: true, + }, + + "primary_dfs_endpoint": { + Type: schema.TypeString, + Computed: true, + }, + + "primary_dfs_host": { + Type: schema.TypeString, + Computed: true, + }, + + "secondary_dfs_endpoint": { + Type: schema.TypeString, + Computed: true, + }, + + "secondary_dfs_host": { + Type: schema.TypeString, + Computed: true, + }, + "primary_file_endpoint": { Type: schema.TypeString, Computed: true, @@ -270,6 +309,16 @@ func resourceArmStorageAccount() *schema.Resource { Computed: true, }, + "secondary_file_endpoint": { + Type: schema.TypeString, + Computed: true, + }, + + "secondary_file_host": { + Type: schema.TypeString, + Computed: true, + }, + "primary_access_key": { Type: schema.TypeString, Sensitive: true, @@ -1093,6 +1142,36 @@ func flattenAndSetAzureRmStorageAccountPrimaryEndpoints(d *schema.ResourceData, d.Set("primary_file_endpoint", fileEndpoint) d.Set("primary_file_host", fileHost) + var webEndpoint, webHost string + if primary != nil { + if v := primary.Web; v != nil { + webEndpoint = *v + + u, err := url.Parse(*v) + if err != nil { + return fmt.Errorf("invalid web endpoint for parsing: %q", *v) + } + webHost = u.Host + } + } + d.Set("primary_web_endpoint", webEndpoint) + d.Set("primary_web_host", webHost) + + var dfsEndpoint, dfsHost string + if primary != nil { + if v := primary.Dfs; v != nil { + dfsEndpoint = *v + + u, err := url.Parse(*v) + if err != nil { + return fmt.Errorf("invalid dfs endpoint for parsing: %q", *v) + } + dfsHost = u.Host + } + } + d.Set("primary_dfs_endpoint", dfsEndpoint) + d.Set("primary_dfs_host", dfsHost) + if primary == nil { return fmt.Errorf("primary endpoints should not be empty") } @@ -1146,5 +1225,49 @@ func flattenAndSetAzureRmStorageAccountSecondaryEndpoints(d *schema.ResourceData d.Set("secondary_table_endpoint", tableEndpoint) d.Set("secondary_table_host", tableHost) + var webEndpoint, webHost string + if secondary != nil { + if v := secondary.Web; v != nil { + webEndpoint = *v + + u, err := url.Parse(*v) + if err != nil { + return fmt.Errorf("invalid web endpoint for parsing: %q", *v) + } + webHost = u.Host + } + } + d.Set("secondary_web_endpoint", webEndpoint) + d.Set("secondary_web_host", webHost) + + var dfsEndpoint, dfsHost string + if secondary != nil { + if v := secondary.Dfs; v != nil { + dfsEndpoint = *v + + u, err := url.Parse(*v) + if err != nil { + return fmt.Errorf("invalid dfs endpoint for parsing: %q", *v) + } + dfsHost = u.Host + } + } + d.Set("secondary_dfs_endpoint", dfsEndpoint) + d.Set("secondary_dfs_host", dfsHost) + + var fileEndpoint, fileHost string + if secondary != nil { + if v := secondary.File; v != nil { + fileEndpoint = *v + + u, err := url.Parse(*v) + if err != nil { + return fmt.Errorf("invalid file endpoint for parsing: %q", *v) + } + tableHost = u.Host + } + } + d.Set("secondary_file_endpoint", fileEndpoint) + d.Set("secondary_file_host", fileHost) return nil } diff --git a/website/docs/d/storage_account.html.markdown b/website/docs/d/storage_account.html.markdown index b8f43966c7d9..697aa8278438 100644 --- a/website/docs/d/storage_account.html.markdown +++ b/website/docs/d/storage_account.html.markdown @@ -92,6 +92,26 @@ output "storage_account_tier" { * `primary_file_host` - The hostname with port if applicable for file storage in the primary location. +* `secondary_file_endpoint` - The endpoint URL for file storage in the secondary location. + +* `secondary_file_host` - The hostname with port if applicable for file storage in the secondary location. + +* `primary_dfs_endpoint` - The endpoint URL for DFS storage in the primary location. + +* `primary_dfs_host` - The hostname with port if applicable for DFS storage in the primary location. + +* `secondary_dfs_endpoint` - The endpoint URL for DFS storage in the secondary location. + +* `secondary_dfs_host` - The hostname with port if applicable for DFS storage in the secondary location. + +* `primary_web_endpoint` - The endpoint URL for web storage in the primary location. + +* `primary_web_host` - The hostname with port if applicable for web storage in the primary location. + +* `secondary_web_endpoint` - The endpoint URL for web storage in the secondary location. + +* `secondary_web_host` - The hostname with port if applicable for web storage in the secondary location. + * `primary_access_key` - The primary access key for the Storage Account. * `secondary_access_key` - The secondary access key for the Storage Account. diff --git a/website/docs/r/storage_account.html.markdown b/website/docs/r/storage_account.html.markdown index 4c2f05f15cb3..1416c0d88a40 100644 --- a/website/docs/r/storage_account.html.markdown +++ b/website/docs/r/storage_account.html.markdown @@ -180,6 +180,26 @@ The following attributes are exported in addition to the arguments listed above: * `primary_file_host` - The hostname with port if applicable for file storage in the primary location. +* `secondary_file_endpoint` - The endpoint URL for file storage in the secondary location. + +* `secondary_file_host` - The hostname with port if applicable for file storage in the secondary location. + +* `primary_dfs_endpoint` - The endpoint URL for DFS storage in the primary location. + +* `primary_dfs_host` - The hostname with port if applicable for DFS storage in the primary location. + +* `secondary_dfs_endpoint` - The endpoint URL for DFS storage in the secondary location. + +* `secondary_dfs_host` - The hostname with port if applicable for DFS storage in the secondary location. + +* `primary_web_endpoint` - The endpoint URL for web storage in the primary location. + +* `primary_web_host` - The hostname with port if applicable for web storage in the primary location. + +* `secondary_web_endpoint` - The endpoint URL for web storage in the secondary location. + +* `secondary_web_host` - The hostname with port if applicable for web storage in the secondary location. + * `primary_access_key` - The primary access key for the storage account. * `secondary_access_key` - The secondary access key for the storage account. From bf9863b8647925b398d975576f5628ecc263787e Mon Sep 17 00:00:00 2001 From: Robert Lippens Date: Sat, 23 Mar 2019 21:16:08 -0700 Subject: [PATCH 2/5] remove comment, fix copy-and-paste bug --- azurerm/data_source_storage_account.go | 1 - azurerm/resource_arm_storage_account.go | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/azurerm/data_source_storage_account.go b/azurerm/data_source_storage_account.go index 830f110cf58a..3b6e4f32d1ce 100644 --- a/azurerm/data_source_storage_account.go +++ b/azurerm/data_source_storage_account.go @@ -191,7 +191,6 @@ func dataSourceArmStorageAccount() *schema.Resource { Computed: true, }, - // NOTE: The API does not appear to expose a secondary file endpoint "primary_file_endpoint": { Type: schema.TypeString, Computed: true, diff --git a/azurerm/resource_arm_storage_account.go b/azurerm/resource_arm_storage_account.go index eb0222ff577f..681a78fa8cbd 100644 --- a/azurerm/resource_arm_storage_account.go +++ b/azurerm/resource_arm_storage_account.go @@ -1264,7 +1264,7 @@ func flattenAndSetAzureRmStorageAccountSecondaryEndpoints(d *schema.ResourceData if err != nil { return fmt.Errorf("invalid file endpoint for parsing: %q", *v) } - tableHost = u.Host + fileHost = u.Host } } d.Set("secondary_file_endpoint", fileEndpoint) From aa8f65b52e6c2e7721b973a65ec2f39723e5105d Mon Sep 17 00:00:00 2001 From: Robert Lippens Date: Mon, 25 Mar 2019 13:31:04 -0700 Subject: [PATCH 3/5] refactor to use helper function --- azurerm/resource_arm_storage_account.go | 197 +++++------------------- 1 file changed, 37 insertions(+), 160 deletions(-) diff --git a/azurerm/resource_arm_storage_account.go b/azurerm/resource_arm_storage_account.go index 681a78fa8cbd..396667665296 100644 --- a/azurerm/resource_arm_storage_account.go +++ b/azurerm/resource_arm_storage_account.go @@ -1082,95 +1082,24 @@ func getBlobConnectionString(blobEndpoint *string, acctName *string, acctKey *st } func flattenAndSetAzureRmStorageAccountPrimaryEndpoints(d *schema.ResourceData, primary *storage.Endpoints) error { - var blobEndpoint, blobHost string - if primary != nil { - if v := primary.Blob; v != nil { - blobEndpoint = *v - - u, err := url.Parse(*v) - if err != nil { - return fmt.Errorf("invalid blob endpoint for parsing: %q", *v) - } - blobHost = u.Host - } + if err := setEndpointAndHost(d, primary, "primary", primary.Blob, "blob"); err != nil { + return err } - d.Set("primary_blob_endpoint", blobEndpoint) - d.Set("primary_blob_host", blobHost) - - var queueEndpoint, queueHost string - if primary != nil { - if v := primary.Queue; v != nil { - queueEndpoint = *v - - u, err := url.Parse(*v) - if err != nil { - return fmt.Errorf("invalid queue endpoint for parsing: %q", *v) - } - queueHost = u.Host - } + if err := setEndpointAndHost(d, primary, "primary", primary.Dfs, "dfs"); err != nil { + return err } - d.Set("primary_queue_endpoint", queueEndpoint) - d.Set("primary_queue_host", queueHost) - - var tableEndpoint, tableHost string - if primary != nil { - if v := primary.Table; v != nil { - tableEndpoint = *v - - u, err := url.Parse(*v) - if err != nil { - return fmt.Errorf("invalid table endpoint for parsing: %q", *v) - } - tableHost = u.Host - } + if err := setEndpointAndHost(d, primary, "primary", primary.File, "file"); err != nil { + return err } - d.Set("primary_table_endpoint", tableEndpoint) - d.Set("primary_table_host", tableHost) - - var fileEndpoint, fileHost string - if primary != nil { - if v := primary.File; v != nil { - fileEndpoint = *v - - u, err := url.Parse(*v) - if err != nil { - return fmt.Errorf("invalid file endpoint for parsing: %q", *v) - } - fileHost = u.Host - } + if err := setEndpointAndHost(d, primary, "primary", primary.Queue, "queue"); err != nil { + return err } - d.Set("primary_file_endpoint", fileEndpoint) - d.Set("primary_file_host", fileHost) - - var webEndpoint, webHost string - if primary != nil { - if v := primary.Web; v != nil { - webEndpoint = *v - - u, err := url.Parse(*v) - if err != nil { - return fmt.Errorf("invalid web endpoint for parsing: %q", *v) - } - webHost = u.Host - } + if err := setEndpointAndHost(d, primary, "primary", primary.Table, "table"); err != nil { + return err } - d.Set("primary_web_endpoint", webEndpoint) - d.Set("primary_web_host", webHost) - - var dfsEndpoint, dfsHost string - if primary != nil { - if v := primary.Dfs; v != nil { - dfsEndpoint = *v - - u, err := url.Parse(*v) - if err != nil { - return fmt.Errorf("invalid dfs endpoint for parsing: %q", *v) - } - dfsHost = u.Host - } + if err := setEndpointAndHost(d, primary, "primary", primary.Web, "web"); err != nil { + return err } - d.Set("primary_dfs_endpoint", dfsEndpoint) - d.Set("primary_dfs_host", dfsHost) if primary == nil { return fmt.Errorf("primary endpoints should not be empty") @@ -1180,94 +1109,42 @@ func flattenAndSetAzureRmStorageAccountPrimaryEndpoints(d *schema.ResourceData, } func flattenAndSetAzureRmStorageAccountSecondaryEndpoints(d *schema.ResourceData, secondary *storage.Endpoints) error { - var blobEndpoint, blobHost string - if secondary != nil { - if v := secondary.Blob; v != nil { - blobEndpoint = *v - - if u, err := url.Parse(*v); err == nil { - blobHost = u.Host - } else { - return fmt.Errorf("invalid blob endpoint for parsing: %q", *v) - } - } + if err := setEndpointAndHost(d, secondary, "secondary", secondary.Blob, "blob"); err != nil { + return err } - d.Set("secondary_blob_endpoint", blobEndpoint) - d.Set("secondary_blob_host", blobHost) - - var queueEndpoint, queueHost string - if secondary != nil { - if v := secondary.Queue; v != nil { - queueEndpoint = *v - - u, err := url.Parse(*v) - if err != nil { - return fmt.Errorf("invalid queue endpoint for parsing: %q", *v) - } - queueHost = u.Host - } + if err := setEndpointAndHost(d, secondary, "secondary", secondary.Dfs, "dfs"); err != nil { + return err } - d.Set("secondary_queue_endpoint", queueEndpoint) - d.Set("secondary_queue_host", queueHost) - - var tableEndpoint, tableHost string - if secondary != nil { - if v := secondary.Table; v != nil { - tableEndpoint = *v - - u, err := url.Parse(*v) - if err != nil { - return fmt.Errorf("invalid table endpoint for parsing: %q", *v) - } - tableHost = u.Host - } + if err := setEndpointAndHost(d, secondary, "secondary", secondary.File, "file"); err != nil { + return err } - d.Set("secondary_table_endpoint", tableEndpoint) - d.Set("secondary_table_host", tableHost) - - var webEndpoint, webHost string - if secondary != nil { - if v := secondary.Web; v != nil { - webEndpoint = *v - - u, err := url.Parse(*v) - if err != nil { - return fmt.Errorf("invalid web endpoint for parsing: %q", *v) - } - webHost = u.Host - } + if err := setEndpointAndHost(d, secondary, "secondary", secondary.Queue, "queue"); err != nil { + return err } - d.Set("secondary_web_endpoint", webEndpoint) - d.Set("secondary_web_host", webHost) - - var dfsEndpoint, dfsHost string - if secondary != nil { - if v := secondary.Dfs; v != nil { - dfsEndpoint = *v - - u, err := url.Parse(*v) - if err != nil { - return fmt.Errorf("invalid dfs endpoint for parsing: %q", *v) - } - dfsHost = u.Host - } + if err := setEndpointAndHost(d, secondary, "secondary", secondary.Table, "table"); err != nil { + return err } - d.Set("secondary_dfs_endpoint", dfsEndpoint) - d.Set("secondary_dfs_host", dfsHost) + if err := setEndpointAndHost(d, secondary, "secondary", secondary.Web, "web"); err != nil { + return err + } + return nil +} - var fileEndpoint, fileHost string - if secondary != nil { - if v := secondary.File; v != nil { - fileEndpoint = *v +func setEndpointAndHost(d *schema.ResourceData, ordinal *storage.Endpoints, ordinalString string, endpointType *string, typeString string) error { + var endpoint, host string + if ordinal != nil { + if v := endpointType; v != nil { + endpoint = *v u, err := url.Parse(*v) if err != nil { - return fmt.Errorf("invalid file endpoint for parsing: %q", *v) + return fmt.Errorf("invalid %s endpoint for parsing: %q", typeString, *v) } - fileHost = u.Host + host = u.Host } } - d.Set("secondary_file_endpoint", fileEndpoint) - d.Set("secondary_file_host", fileHost) + + d.Set(fmt.Sprintf("%s_%s_endpoint", ordinalString, typeString), endpoint) + d.Set(fmt.Sprintf("%s_%s_host", ordinalString, typeString), host) return nil } From 8196aa894cc91330aff8e2ed77d08423f21d97f9 Mon Sep 17 00:00:00 2001 From: Robert Lippens Date: Thu, 28 Mar 2019 09:49:19 -0700 Subject: [PATCH 4/5] fix reference bug --- azurerm/resource_arm_storage_account.go | 72 ++++++++++++++----------- 1 file changed, 41 insertions(+), 31 deletions(-) diff --git a/azurerm/resource_arm_storage_account.go b/azurerm/resource_arm_storage_account.go index 396667665296..66ddeaa47b4f 100644 --- a/azurerm/resource_arm_storage_account.go +++ b/azurerm/resource_arm_storage_account.go @@ -1082,66 +1082,76 @@ func getBlobConnectionString(blobEndpoint *string, acctName *string, acctKey *st } func flattenAndSetAzureRmStorageAccountPrimaryEndpoints(d *schema.ResourceData, primary *storage.Endpoints) error { - if err := setEndpointAndHost(d, primary, "primary", primary.Blob, "blob"); err != nil { - return err + if primary == nil { + return fmt.Errorf("primary endpoints should not be empty") } - if err := setEndpointAndHost(d, primary, "primary", primary.Dfs, "dfs"); err != nil { + + if err := setEndpointAndHost(d, "primary", primary.Blob, "blob"); err != nil { return err } - if err := setEndpointAndHost(d, primary, "primary", primary.File, "file"); err != nil { + if err := setEndpointAndHost(d, "primary", primary.Dfs, "dfs"); err != nil { return err } - if err := setEndpointAndHost(d, primary, "primary", primary.Queue, "queue"); err != nil { + if err := setEndpointAndHost(d, "primary", primary.File, "file"); err != nil { return err } - if err := setEndpointAndHost(d, primary, "primary", primary.Table, "table"); err != nil { + if err := setEndpointAndHost(d, "primary", primary.Queue, "queue"); err != nil { return err } - if err := setEndpointAndHost(d, primary, "primary", primary.Web, "web"); err != nil { + if err := setEndpointAndHost(d, "primary", primary.Table, "table"); err != nil { return err } - - if primary == nil { - return fmt.Errorf("primary endpoints should not be empty") + if err := setEndpointAndHost(d, "primary", primary.Web, "web"); err != nil { + return err } return nil } func flattenAndSetAzureRmStorageAccountSecondaryEndpoints(d *schema.ResourceData, secondary *storage.Endpoints) error { - if err := setEndpointAndHost(d, secondary, "secondary", secondary.Blob, "blob"); err != nil { - return err + if secondary != nil { + if err := setEndpointAndHost(d, "secondary", secondary.Blob, "blob"); err != nil { + return err + } } - if err := setEndpointAndHost(d, secondary, "secondary", secondary.Dfs, "dfs"); err != nil { - return err + if secondary != nil { + if err := setEndpointAndHost(d, "secondary", secondary.Dfs, "dfs"); err != nil { + return err + } } - if err := setEndpointAndHost(d, secondary, "secondary", secondary.File, "file"); err != nil { - return err + if secondary != nil { + if err := setEndpointAndHost(d, "secondary", secondary.File, "file"); err != nil { + return err + } } - if err := setEndpointAndHost(d, secondary, "secondary", secondary.Queue, "queue"); err != nil { - return err + if secondary != nil { + if err := setEndpointAndHost(d, "secondary", secondary.Queue, "queue"); err != nil { + return err + } } - if err := setEndpointAndHost(d, secondary, "secondary", secondary.Table, "table"); err != nil { - return err + if secondary != nil { + if err := setEndpointAndHost(d, "secondary", secondary.Table, "table"); err != nil { + return err + } } - if err := setEndpointAndHost(d, secondary, "secondary", secondary.Web, "web"); err != nil { - return err + if secondary != nil { + if err := setEndpointAndHost(d, "secondary", secondary.Web, "web"); err != nil { + return err + } } return nil } -func setEndpointAndHost(d *schema.ResourceData, ordinal *storage.Endpoints, ordinalString string, endpointType *string, typeString string) error { +func setEndpointAndHost(d *schema.ResourceData, ordinalString string, endpointType *string, typeString string) error { var endpoint, host string - if ordinal != nil { - if v := endpointType; v != nil { - endpoint = *v + if v := endpointType; v != nil { + endpoint = *v - u, err := url.Parse(*v) - if err != nil { - return fmt.Errorf("invalid %s endpoint for parsing: %q", typeString, *v) - } - host = u.Host + u, err := url.Parse(*v) + if err != nil { + return fmt.Errorf("invalid %s endpoint for parsing: %q", typeString, *v) } + host = u.Host } d.Set(fmt.Sprintf("%s_%s_endpoint", ordinalString, typeString), endpoint) From de05e0d4bfc3e6e8a691736cbcc3bfa85ff2e1c6 Mon Sep 17 00:00:00 2001 From: Robert Lippens Date: Thu, 28 Mar 2019 09:52:49 -0700 Subject: [PATCH 5/5] top-level nil check for secondary --- azurerm/resource_arm_storage_account.go | 40 ++++++++++--------------- 1 file changed, 16 insertions(+), 24 deletions(-) diff --git a/azurerm/resource_arm_storage_account.go b/azurerm/resource_arm_storage_account.go index 66ddeaa47b4f..b7512638a780 100644 --- a/azurerm/resource_arm_storage_account.go +++ b/azurerm/resource_arm_storage_account.go @@ -1109,35 +1109,27 @@ func flattenAndSetAzureRmStorageAccountPrimaryEndpoints(d *schema.ResourceData, } func flattenAndSetAzureRmStorageAccountSecondaryEndpoints(d *schema.ResourceData, secondary *storage.Endpoints) error { - if secondary != nil { - if err := setEndpointAndHost(d, "secondary", secondary.Blob, "blob"); err != nil { - return err - } + if secondary == nil { + return nil } - if secondary != nil { - if err := setEndpointAndHost(d, "secondary", secondary.Dfs, "dfs"); err != nil { - return err - } + + if err := setEndpointAndHost(d, "secondary", secondary.Blob, "blob"); err != nil { + return err } - if secondary != nil { - if err := setEndpointAndHost(d, "secondary", secondary.File, "file"); err != nil { - return err - } + if err := setEndpointAndHost(d, "secondary", secondary.Dfs, "dfs"); err != nil { + return err } - if secondary != nil { - if err := setEndpointAndHost(d, "secondary", secondary.Queue, "queue"); err != nil { - return err - } + if err := setEndpointAndHost(d, "secondary", secondary.File, "file"); err != nil { + return err } - if secondary != nil { - if err := setEndpointAndHost(d, "secondary", secondary.Table, "table"); err != nil { - return err - } + if err := setEndpointAndHost(d, "secondary", secondary.Queue, "queue"); err != nil { + return err } - if secondary != nil { - if err := setEndpointAndHost(d, "secondary", secondary.Web, "web"); err != nil { - return err - } + if err := setEndpointAndHost(d, "secondary", secondary.Table, "table"); err != nil { + return err + } + if err := setEndpointAndHost(d, "secondary", secondary.Web, "web"); err != nil { + return err } return nil }