Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions internal/services/search/search_service_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ func dataSourceSearchService() *pluginsdk.Resource {
Computed: true,
},

"endpoint": {
Type: pluginsdk.TypeString,
Computed: true,
},

"replica_count": {
Type: pluginsdk.TypeInt,
Computed: true,
Expand Down Expand Up @@ -119,6 +124,7 @@ func dataSourceSearchServiceRead(d *pluginsdk.ResourceData, meta interface{}) er
partitionCount := 1
replicaCount := 1
publicNetworkAccess := true
endpoint := ""

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

if props.Endpoint != nil {
endpoint = pointer.From(props.Endpoint)
}

d.Set("partition_count", partitionCount)
d.Set("replica_count", replicaCount)
d.Set("public_network_access_enabled", publicNetworkAccess)
d.Set("endpoint", endpoint)
}

flattenedIdentity, err := identity.FlattenSystemAndUserAssignedMap(model.Identity)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ func TestAccDataSourceSearchService_basic(t *testing.T) {
{
Config: r.basic(data),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).Key("endpoint").Exists(),
check.That(data.ResourceName).Key("customer_managed_key_encryption_compliance_status").Exists(),
check.That(data.ResourceName).Key("replica_count").Exists(),
check.That(data.ResourceName).Key("partition_count").Exists(),
Expand Down
11 changes: 11 additions & 0 deletions internal/services/search/search_service_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,11 @@ func resourceSearchService() *pluginsdk.Resource {
Computed: true,
},

"endpoint": {
Type: pluginsdk.TypeString,
Computed: true,
},

"primary_key": {
Type: pluginsdk.TypeString,
Computed: true,
Expand Down Expand Up @@ -574,6 +579,7 @@ func resourceSearchServiceRead(d *pluginsdk.ResourceData, meta interface{}) erro
replicaCount := 1 // Default
publicNetworkAccess := true // publicNetworkAccess defaults to true...
cmkEnforcement := false // cmkEnforcment defaults to false...
endpoint := ""
hostingMode := services.HostingModeDefault
localAuthEnabled := true
authFailureMode := ""
Expand Down Expand Up @@ -602,6 +608,10 @@ func resourceSearchServiceRead(d *pluginsdk.ResourceData, meta interface{}) erro
d.Set("customer_managed_key_encryption_compliance_status", string(pointer.From(props.EncryptionWithCmk.EncryptionComplianceStatus)))
}

if props.Endpoint != nil {
endpoint = pointer.From(props.Endpoint)
}

// I am using 'DisableLocalAuth' here because when you are in
// RBAC Only Mode, the 'props.AuthOptions' will be 'nil'...
if props.DisableLocalAuth != nil {
Expand All @@ -628,6 +638,7 @@ func resourceSearchServiceRead(d *pluginsdk.ResourceData, meta interface{}) erro
d.Set("replica_count", replicaCount)
d.Set("public_network_access_enabled", publicNetworkAccess)
d.Set("hosting_mode", hostingMode)
d.Set("endpoint", endpoint)
d.Set("customer_managed_key_enforcement_enabled", cmkEnforcement)
d.Set("allowed_ips", flattenSearchServiceIPRules(props.NetworkRuleSet))
d.Set("semantic_search_sku", semanticSearchSku)
Expand Down
1 change: 1 addition & 0 deletions internal/services/search/search_service_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ func TestAccSearchService_basicSku(t *testing.T) {
Config: r.basic(data, "basic"),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
check.That(data.ResourceName).Key("endpoint").Exists(),
check.That(data.ResourceName).Key("semantic_search_sku").HasValue(""),
),
},
Expand Down
2 changes: 2 additions & 0 deletions website/docs/d/search_service.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ In addition to the Arguments listed above - the following Attributes are exporte

* `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`.

* `endpoint` - The endpoint used to connect to this Search Service.

* `primary_key` - The Primary Key used for Search Service Administration.

* `secondary_key` - The Secondary Key used for Search Service Administration.
Expand Down
2 changes: 2 additions & 0 deletions website/docs/r/search_service.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ In addition to the Arguments listed above - the following Attributes are exporte

* `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`.

* `endpoint` - The endpoint used to connect to this Search Service.

* `primary_key` - The Primary Key used for Search Service Administration.

* `query_keys` - A `query_keys` block as defined below.
Expand Down
Loading