Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
10 changes: 8 additions & 2 deletions internal/services/cognitive/ai_services_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,15 @@ import (
"github.com/hashicorp/terraform-provider-azurerm/utils"
)

var _ sdk.ResourceWithUpdate = AIServices{}
func (r AIServices) DeprecatedInFavourOfResource() string {
return "azurerm_cognitive_account"
}

var _ sdk.ResourceWithCustomImporter = AIServices{}
var (
_ sdk.ResourceWithUpdate = AIServices{}
_ sdk.ResourceWithCustomImporter = AIServices{}
_ sdk.ResourceWithDeprecationReplacedBy = AIServices{}
)

type AIServices struct{}

Expand Down
25 changes: 25 additions & 0 deletions internal/services/cognitive/ai_services_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,16 @@ import (
"github.com/hashicorp/terraform-provider-azurerm/internal/acceptance"
"github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
"github.com/hashicorp/terraform-provider-azurerm/internal/features"
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk"
)

type AIServices struct{}

func TestAccCognitiveAIServices_basic(t *testing.T) {
if features.FivePointOh() {
t.Skipf("Skipping since `azurerm_ai_services` is deprecated and will be removed in 5.0")
}
data := acceptance.BuildTestData(t, "azurerm_ai_services", "test")
r := AIServices{}

Expand All @@ -38,6 +42,9 @@ func TestAccCognitiveAIServices_basic(t *testing.T) {
}

func TestAccCognitiveAIServices_requiresImport(t *testing.T) {
if features.FivePointOh() {
t.Skipf("Skipping since `azurerm_ai_services` is deprecated and will be removed in 5.0")
}
data := acceptance.BuildTestData(t, "azurerm_ai_services", "test")
r := AIServices{}

Expand All @@ -53,6 +60,9 @@ func TestAccCognitiveAIServices_requiresImport(t *testing.T) {
}

func TestAccCognitiveAIServices_complete(t *testing.T) {
if features.FivePointOh() {
t.Skipf("Skipping since `azurerm_ai_services` is deprecated and will be removed in 5.0")
}
data := acceptance.BuildTestData(t, "azurerm_ai_services", "test")
r := AIServices{}

Expand All @@ -70,6 +80,9 @@ func TestAccCognitiveAIServices_complete(t *testing.T) {
}

func TestAccCognitiveAIServices_update(t *testing.T) {
if features.FivePointOh() {
t.Skipf("Skipping since `azurerm_ai_services` is deprecated and will be removed in 5.0")
}
data := acceptance.BuildTestData(t, "azurerm_ai_services", "test")
r := AIServices{}

Expand All @@ -90,6 +103,9 @@ func TestAccCognitiveAIServices_update(t *testing.T) {
}

func TestAccCognitiveAIServices_networkACLs(t *testing.T) {
if features.FivePointOh() {
t.Skipf("Skipping since `azurerm_ai_services` is deprecated and will be removed in 5.0")
}
data := acceptance.BuildTestData(t, "azurerm_ai_services", "test")
r := AIServices{}

Expand Down Expand Up @@ -119,6 +135,9 @@ func TestAccCognitiveAIServices_networkACLs(t *testing.T) {
}

func TestAccCognitiveAIServices_identity(t *testing.T) {
if features.FivePointOh() {
t.Skipf("Skipping since `azurerm_ai_services` is deprecated and will be removed in 5.0")
}
data := acceptance.BuildTestData(t, "azurerm_ai_services", "test")
r := AIServices{}

Expand Down Expand Up @@ -159,6 +178,9 @@ func TestAccCognitiveAIServices_identity(t *testing.T) {
}

func TestAccCognitiveAIServices_customerManagedKey_update(t *testing.T) {
if features.FivePointOh() {
t.Skipf("Skipping since `azurerm_ai_services` is deprecated and will be removed in 5.0")
}
data := acceptance.BuildTestData(t, "azurerm_ai_services", "test")
r := AIServices{}

Expand Down Expand Up @@ -192,6 +214,9 @@ func TestAccCognitiveAIServices_customerManagedKey_update(t *testing.T) {
}

func TestAccCognitiveAIServices_KVHsmManagedKey(t *testing.T) {
if features.FivePointOh() {
t.Skipf("Skipping since `azurerm_ai_services` is deprecated and will be removed in 5.0")
}
if os.Getenv("ARM_TEST_HSM_KEY") == "" {
t.Skip("Skipping as ARM_TEST_HSM_KEY is not specified")
return
Expand Down
10 changes: 8 additions & 2 deletions internal/services/cognitive/registration.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package cognitive
import (
"github.com/hashicorp/terraform-plugin-framework/action"
"github.com/hashicorp/terraform-plugin-framework/ephemeral"
"github.com/hashicorp/terraform-provider-azurerm/internal/features"
"github.com/hashicorp/terraform-provider-azurerm/internal/sdk"
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk"
)
Expand Down Expand Up @@ -58,13 +59,18 @@ func (r Registration) DataSources() []sdk.DataSource {

// Resources returns a list of Resources supported by this Service
func (r Registration) Resources() []sdk.Resource {
return []sdk.Resource{
AIServices{},
resources := []sdk.Resource{
CognitiveAccountProjectResource{},
CognitiveAccountRaiPolicyResource{},
CognitiveDeploymentResource{},
CognitiveRaiBlocklistResource{},
}

if !features.FivePointOh() {
resources = append(resources, AIServices{})
}

return resources
}

func (r Registration) Actions() []func() action.Action {
Expand Down
16 changes: 5 additions & 11 deletions internal/services/machinelearning/ai_foundry_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ provider "azurerm" {

resource "azurerm_ai_foundry" "test" {
name = "acctestaihub-%[2]d"
location = azurerm_ai_services.test.location
location = azurerm_resource_group.test.location
resource_group_name = azurerm_resource_group.test.name
storage_account_id = azurerm_storage_account.test.id
key_vault_id = azurerm_key_vault.test.id
Expand Down Expand Up @@ -195,7 +195,7 @@ resource "azurerm_user_assigned_identity" "test" {

resource "azurerm_ai_foundry" "test" {
name = "acctestaihub-%[2]d"
location = azurerm_ai_services.test.location
location = azurerm_resource_group.test.location
resource_group_name = azurerm_resource_group.test.name
storage_account_id = azurerm_storage_account.test.id
key_vault_id = azurerm_key_vault.test.id
Expand Down Expand Up @@ -270,7 +270,7 @@ resource "azurerm_user_assigned_identity" "test2" {

resource "azurerm_ai_foundry" "test" {
name = "acctestaihub-%[2]d"
location = azurerm_ai_services.test.location
location = azurerm_resource_group.test.location
resource_group_name = azurerm_resource_group.test.name
storage_account_id = azurerm_storage_account.test.id
key_vault_id = azurerm_key_vault.test.id
Expand Down Expand Up @@ -358,7 +358,7 @@ resource "azurerm_role_assignment" "test_kv" {

resource "azurerm_ai_foundry" "test" {
name = "acctestaihub-%[2]d"
location = azurerm_ai_services.test.location
location = azurerm_resource_group.test.location
resource_group_name = azurerm_resource_group.test.name
storage_account_id = azurerm_storage_account.test.id
key_vault_id = azurerm_key_vault.test.id
Expand Down Expand Up @@ -417,7 +417,7 @@ resource "azurerm_key_vault_key" "test" {

resource "azurerm_ai_foundry" "test" {
name = "acctestaihub-%[2]d"
location = azurerm_ai_services.test.location
location = azurerm_resource_group.test.location
resource_group_name = azurerm_resource_group.test.name
storage_account_id = azurerm_storage_account.test.id
key_vault_id = azurerm_key_vault.test.id
Expand Down Expand Up @@ -496,11 +496,5 @@ resource "azurerm_storage_account" "test" {
account_replication_type = "LRS"
}

resource "azurerm_ai_services" "test" {
Comment thread
magodo marked this conversation as resolved.
name = "acctestaiservices-%[1]d"
location = azurerm_resource_group.test.location
resource_group_name = azurerm_resource_group.test.name
sku_name = "S0"
}
`, data.RandomInteger, data.Locations.Primary, data.RandomString)
}
4 changes: 4 additions & 0 deletions website/docs/5.0-upgrade-guide.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ Please follow the format in the example below for adding removed resources:
This deprecated resource has been superseded/retired and has been removed from the Azure Provider.
```

### `azurerm_ai_services`

* This deprecated resource has been retired and has been removed from the Azure Provider.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use the wording format for superseded removal

Suggested change
* This deprecated resource has been retired and has been removed from the Azure Provider.
* This deprecated resource has been superseded by `azurerm_cognitive_account` and has been removed from the Azure Provider.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed


### `azurerm_automation_software_update_configuration`

* This deprecated resource has been retired and has been removed from the Azure Provider.
Expand Down
9 changes: 1 addition & 8 deletions website/docs/r/ai_foundry.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,9 @@ resource "azurerm_storage_account" "example" {
account_replication_type = "LRS"
}

resource "azurerm_ai_services" "example" {
name = "exampleaiservices"
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
sku_name = "S0"
}

resource "azurerm_ai_foundry" "example" {
name = "exampleaihub"
location = azurerm_ai_services.example.location
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
storage_account_id = azurerm_storage_account.example.id
key_vault_id = azurerm_key_vault.example.id
Expand Down
9 changes: 1 addition & 8 deletions website/docs/r/ai_foundry_project.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,9 @@ resource "azurerm_storage_account" "example" {
account_replication_type = "LRS"
}

resource "azurerm_ai_services" "example" {
name = "exampleaiservices"
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
sku_name = "S0"
}

resource "azurerm_ai_foundry" "example" {
name = "exampleaihub"
location = azurerm_ai_services.example.location
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
storage_account_id = azurerm_storage_account.example.id
key_vault_id = azurerm_key_vault.example.id
Expand Down
3 changes: 3 additions & 0 deletions website/docs/r/ai_services.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ description: |-

Manages an AI Services Account.

~> **Note:** The `azurerm_ai_services` resource has been deprecated and will be removed in v5.0 of the AzureRM Provider. Please use [`azurerm_cognitive_account`](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/cognitive_account) resource instead.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not hardcode full URI, use relative link instead

Suggested change
~> **Note:** The `azurerm_ai_services` resource has been deprecated and will be removed in v5.0 of the AzureRM Provider. Please use [`azurerm_cognitive_account`](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/cognitive_account) resource instead.
~> **Note:** The `azurerm_ai_services` resource has been deprecated and will be removed in v5.0 of the AzureRM Provider. Please use [`azurerm_cognitive_account`](cognitive_account.html.markdown) resource instead.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed



## Example Usage

```hcl
Expand Down