Skip to content

Commit f220268

Browse files
baranyaimateMáté Baranyai
authored andcommitted
azurerm_search_service: add computed endpoint attribute
1 parent 9a03001 commit f220268

6 files changed

Lines changed: 28 additions & 0 deletions

File tree

internal/services/search/search_service_data_source.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ func dataSourceSearchService() *pluginsdk.Resource {
4343
Computed: true,
4444
},
4545

46+
"endpoint": {
47+
Type: pluginsdk.TypeString,
48+
Computed: true,
49+
},
50+
4651
"replica_count": {
4752
Type: pluginsdk.TypeInt,
4853
Computed: true,
@@ -119,6 +124,7 @@ func dataSourceSearchServiceRead(d *pluginsdk.ResourceData, meta interface{}) er
119124
partitionCount := 1
120125
replicaCount := 1
121126
publicNetworkAccess := true
127+
endpoint := ""
122128

123129
if props.EncryptionWithCmk != nil {
124130
d.Set("customer_managed_key_encryption_compliance_status", string(pointer.From(props.EncryptionWithCmk.EncryptionComplianceStatus)))
@@ -136,9 +142,14 @@ func dataSourceSearchServiceRead(d *pluginsdk.ResourceData, meta interface{}) er
136142
publicNetworkAccess = strings.EqualFold(string(pointer.From(props.PublicNetworkAccess)), string(services.PublicNetworkAccessEnabled))
137143
}
138144

145+
if props.Endpoint != nil {
146+
endpoint = pointer.From(props.Endpoint)
147+
}
148+
139149
d.Set("partition_count", partitionCount)
140150
d.Set("replica_count", replicaCount)
141151
d.Set("public_network_access_enabled", publicNetworkAccess)
152+
d.Set("endpoint", endpoint)
142153
}
143154

144155
flattenedIdentity, err := identity.FlattenSystemAndUserAssignedMap(model.Identity)

internal/services/search/search_service_data_source_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ func TestAccDataSourceSearchService_basic(t *testing.T) {
2121
{
2222
Config: r.basic(data),
2323
Check: acceptance.ComposeTestCheckFunc(
24+
check.That(data.ResourceName).Key("endpoint").Exists(),
2425
check.That(data.ResourceName).Key("customer_managed_key_encryption_compliance_status").Exists(),
2526
check.That(data.ResourceName).Key("replica_count").Exists(),
2627
check.That(data.ResourceName).Key("partition_count").Exists(),

internal/services/search/search_service_resource.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,11 @@ func resourceSearchService() *pluginsdk.Resource {
137137
Computed: true,
138138
},
139139

140+
"endpoint": {
141+
Type: pluginsdk.TypeString,
142+
Computed: true,
143+
},
144+
140145
"primary_key": {
141146
Type: pluginsdk.TypeString,
142147
Computed: true,
@@ -574,6 +579,7 @@ func resourceSearchServiceRead(d *pluginsdk.ResourceData, meta interface{}) erro
574579
replicaCount := 1 // Default
575580
publicNetworkAccess := true // publicNetworkAccess defaults to true...
576581
cmkEnforcement := false // cmkEnforcment defaults to false...
582+
endpoint := ""
577583
hostingMode := services.HostingModeDefault
578584
localAuthEnabled := true
579585
authFailureMode := ""
@@ -602,6 +608,10 @@ func resourceSearchServiceRead(d *pluginsdk.ResourceData, meta interface{}) erro
602608
d.Set("customer_managed_key_encryption_compliance_status", string(pointer.From(props.EncryptionWithCmk.EncryptionComplianceStatus)))
603609
}
604610

611+
if props.Endpoint != nil {
612+
endpoint = pointer.From(props.Endpoint)
613+
}
614+
605615
// I am using 'DisableLocalAuth' here because when you are in
606616
// RBAC Only Mode, the 'props.AuthOptions' will be 'nil'...
607617
if props.DisableLocalAuth != nil {
@@ -628,6 +638,7 @@ func resourceSearchServiceRead(d *pluginsdk.ResourceData, meta interface{}) erro
628638
d.Set("replica_count", replicaCount)
629639
d.Set("public_network_access_enabled", publicNetworkAccess)
630640
d.Set("hosting_mode", hostingMode)
641+
d.Set("endpoint", endpoint)
631642
d.Set("customer_managed_key_enforcement_enabled", cmkEnforcement)
632643
d.Set("allowed_ips", flattenSearchServiceIPRules(props.NetworkRuleSet))
633644
d.Set("semantic_search_sku", semanticSearchSku)

internal/services/search/search_service_resource_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ func TestAccSearchService_basicSku(t *testing.T) {
2828
Config: r.basic(data, "basic"),
2929
Check: acceptance.ComposeTestCheckFunc(
3030
check.That(data.ResourceName).ExistsInAzure(r),
31+
check.That(data.ResourceName).Key("endpoint").Exists(),
3132
check.That(data.ResourceName).Key("semantic_search_sku").HasValue(""),
3233
),
3334
},

website/docs/d/search_service.html.markdown

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ In addition to the Arguments listed above - the following Attributes are exporte
4040

4141
* `customer_managed_key_encryption_compliance_status` - Describes whether the search service is compliant or not with respect to having non-customer encrypted resources. If a service has more than one non-customer encrypted resource and `Enforcement` is `enabled` then the service will be marked as `NonCompliant`. If all the resources are customer encrypted, then the service will be marked as `Compliant`.
4242

43+
* `endpoint` - The endpoint used to connect to this Search Service.
44+
4345
* `primary_key` - The Primary Key used for Search Service Administration.
4446

4547
* `secondary_key` - The Secondary Key used for Search Service Administration.

website/docs/r/search_service.html.markdown

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,8 @@ In addition to the Arguments listed above - the following Attributes are exporte
136136

137137
* `customer_managed_key_encryption_compliance_status` - Describes whether the search service is compliant or not with respect to having non-customer encrypted resources. If a service has more than one non-customer encrypted resource and `Enforcement` is `enabled` then the service will be marked as `NonCompliant`. If all the resources are customer encrypted, then the service will be marked as `Compliant`.
138138

139+
* `endpoint` - The endpoint used to connect to this Search Service.
140+
139141
* `primary_key` - The Primary Key used for Search Service Administration.
140142

141143
* `query_keys` - A `query_keys` block as defined below.

0 commit comments

Comments
 (0)