Skip to content

Commit

Permalink
Rename to custom_question_answering_search_service_id
Browse files Browse the repository at this point in the history
  • Loading branch information
myc2h6o committed Mar 15, 2022
1 parent b4c059f commit 34da375
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 25 deletions.
8 changes: 4 additions & 4 deletions internal/services/cognitive/cognitive_account_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ func resourceCognitiveAccountRead(d *pluginsdk.ResourceData, meta interface{}) e
if props := model.Properties; props != nil {
if apiProps := props.ApiProperties; apiProps != nil {
d.Set("qna_runtime_endpoint", apiProps.QnaRuntimeEndpoint)
d.Set("qna_search_endpoint_id", apiProps.QnaAzureSearchEndpointId)
d.Set("custom_question_answering_search_service_id", apiProps.QnaAzureSearchEndpointId)
d.Set("metrics_advisor_aad_client_id", apiProps.AadClientId)
d.Set("metrics_advisor_aad_tenant_id", apiProps.AadTenantId)
d.Set("metrics_advisor_super_user_name", apiProps.SuperUser)
Expand Down Expand Up @@ -504,11 +504,11 @@ func expandCognitiveAccountAPIProperties(d *pluginsdk.ResourceData) (*cognitives
return nil, fmt.Errorf("the QnAMaker runtime endpoint `qna_runtime_endpoint` is required when kind is set to `QnAMaker`")
}
}
if v, ok := d.GetOk("qna_search_endpoint_id"); ok {
if v, ok := d.GetOk("custom_question_answering_search_service_id"); ok {
if kind == "TextAnalytics" {
props.QnaAzureSearchEndpointId = utils.String(v.(string))
} else {
return nil, fmt.Errorf("qna_search_endpoint_id can only used set when kind is set to `TextAnalytics`")
return nil, fmt.Errorf("the Search Service ID `custom_question_answering_search_service_id` can only be set when kind is set to `TextAnalytics`")
}
}
if v, ok := d.GetOk("metrics_advisor_aad_client_id"); ok {
Expand Down Expand Up @@ -816,7 +816,7 @@ func resourceCognitiveAccountSchema() map[string]*pluginsdk.Schema {
ValidateFunc: validation.IsURLWithHTTPorHTTPS,
},

"qna_search_endpoint_id": {
"custom_question_answering_search_service_id": {
Type: pluginsdk.TypeString,
Optional: true,
ValidateFunc: searchValidate.SearchServiceID,
Expand Down
38 changes: 19 additions & 19 deletions internal/services/cognitive/cognitive_account_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,27 +183,27 @@ func TestAccCognitiveAccount_qnaRuntimeEndpointUnspecified(t *testing.T) {
})
}

func TestAccCognitiveAccount_qnaSearchEndpointId(t *testing.T) {
func TestAccCognitiveAccount_customQuestionAnsweringSearchServiceId(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_cognitive_account", "test")
r := CognitiveAccountResource{}

data.ResourceTest(t, r, []acceptance.TestStep{
{
Config: r.qnaSearchEndpointId(data),
Config: r.customQuestionAnsweringSearchServiceId(data),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
),
},
data.ImportStep(),
{
Config: r.qnaSearchEndpointIdUpdated(data),
Config: r.customQuestionAnsweringSearchServiceIdUpdated(data),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
),
},
data.ImportStep(),
{
Config: r.qnaSearchEndpointIdRemoved(data),
Config: r.customQuestionAnsweringSearchServiceIdRemoved(data),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
),
Expand Down Expand Up @@ -625,7 +625,7 @@ resource "azurerm_cognitive_account" "test" {
`, data.RandomInteger, "West US", data.RandomInteger) // QnAMaker only available in West US
}

func (CognitiveAccountResource) qnaSearchEndpointId(data acceptance.TestData) string {
func (CognitiveAccountResource) customQuestionAnsweringSearchServiceId(data acceptance.TestData) string {
return fmt.Sprintf(`
provider "azurerm" {
features {}
Expand All @@ -644,17 +644,17 @@ resource "azurerm_search_service" "test" {
}
resource "azurerm_cognitive_account" "test" {
name = "acctestcogacc-%[1]d"
location = azurerm_resource_group.test.location
resource_group_name = azurerm_resource_group.test.name
kind = "TextAnalytics"
sku_name = "F0"
qna_search_endpoint_id = azurerm_search_service.test.id
name = "acctestcogacc-%[1]d"
location = azurerm_resource_group.test.location
resource_group_name = azurerm_resource_group.test.name
kind = "TextAnalytics"
sku_name = "F0"
custom_question_answering_search_service_id = azurerm_search_service.test.id
}
`, data.RandomInteger, data.Locations.Primary)
}

func (CognitiveAccountResource) qnaSearchEndpointIdUpdated(data acceptance.TestData) string {
func (CognitiveAccountResource) customQuestionAnsweringSearchServiceIdUpdated(data acceptance.TestData) string {
return fmt.Sprintf(`
provider "azurerm" {
features {}
Expand All @@ -680,17 +680,17 @@ resource "azurerm_search_service" "test2" {
}
resource "azurerm_cognitive_account" "test" {
name = "acctestcogacc-%[1]d"
location = azurerm_resource_group.test.location
resource_group_name = azurerm_resource_group.test.name
kind = "TextAnalytics"
sku_name = "F0"
qna_search_endpoint_id = azurerm_search_service.test2.id
name = "acctestcogacc-%[1]d"
location = azurerm_resource_group.test.location
resource_group_name = azurerm_resource_group.test.name
kind = "TextAnalytics"
sku_name = "F0"
custom_question_answering_search_service_id = azurerm_search_service.test2.id
}
`, data.RandomInteger, data.Locations.Primary)
}

func (CognitiveAccountResource) qnaSearchEndpointIdRemoved(data acceptance.TestData) string {
func (CognitiveAccountResource) customQuestionAnsweringSearchServiceIdRemoved(data acceptance.TestData) string {
return fmt.Sprintf(`
provider "azurerm" {
features {}
Expand Down
4 changes: 2 additions & 2 deletions website/docs/d/cognitive_account.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ The following attributes are exported:

* `qna_runtime_endpoint` - If `kind` is `QnAMaker` the link to the QNA runtime.

* `qna_search_endpoint_id` - If `kind` is `TextAnalytics` the ID to the Search service.
* `custom_question_answering_search_service_id` - If `kind` is `TextAnalytics` the ID to the Search service.

-> **NOTE:** `qna_search_endpoint_id` is used for [the new version of QnA Maker](https://docs.microsoft.com/azure/cognitive-services/qnamaker/custom-question-answering), while `qna_runtime_endpoint` is used for [the old version of QnA Maker](https://docs.microsoft.com/azure/cognitive-services/qnamaker/overview/overview)
-> **NOTE:** `custom_question_answering_search_service_id` is used for [Custom Question Answering, the renamed version of QnA Maker](https://docs.microsoft.com/azure/cognitive-services/qnamaker/custom-question-answering), while `qna_runtime_endpoint` is used for [the old version of QnA Maker](https://docs.microsoft.com/azure/cognitive-services/qnamaker/overview/overview)

* `primary_access_key` - The primary access key of the Cognitive Services Account

Expand Down

0 comments on commit 34da375

Please sign in to comment.