Skip to content

Commit

Permalink
FourPointOh removal from 's' resources (#28300)
Browse files Browse the repository at this point in the history
  • Loading branch information
sreallymatt authored Dec 17, 2024
1 parent 6eb4009 commit 626f458
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 162 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"github.com/Azure/azure-sdk-for-go/services/preview/security/mgmt/v3.0/security" // nolint: staticcheck
"github.com/hashicorp/terraform-provider-azurerm/helpers/tf"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
"github.com/hashicorp/terraform-provider-azurerm/internal/features"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/securitycenter/azuresdkhacks"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/securitycenter/parse"
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk"
Expand All @@ -21,7 +20,7 @@ import (
)

func resourceSecurityCenterContact() *pluginsdk.Resource {
resource := &pluginsdk.Resource{
return &pluginsdk.Resource{
Create: resourceSecurityCenterContactCreateUpdate,
Read: resourceSecurityCenterContactRead,
Update: resourceSecurityCenterContactCreateUpdate,
Expand All @@ -40,11 +39,10 @@ func resourceSecurityCenterContact() *pluginsdk.Resource {
},

Schema: map[string]*pluginsdk.Schema{
// This becomes Required and ForceNew in 4.0 - override happens further down
"name": {
Type: pluginsdk.TypeString,
Optional: true,
Default: "default1",
Required: true,
ForceNew: true,
ValidateFunc: validation.StringIsNotEmpty,
},

Expand All @@ -71,17 +69,6 @@ func resourceSecurityCenterContact() *pluginsdk.Resource {
},
},
}

if features.FourPointOh() {
resource.Schema["name"] = &pluginsdk.Schema{
Type: pluginsdk.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: validation.StringIsNotEmpty,
}
}

return resource
}

func resourceSecurityCenterContactCreateUpdate(d *pluginsdk.ResourceData, meta interface{}) error {
Expand Down
14 changes: 0 additions & 14 deletions internal/services/servicebus/servicebus_topic_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
"github.com/hashicorp/terraform-provider-azurerm/helpers/tf"
"github.com/hashicorp/terraform-provider-azurerm/helpers/validate"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
"github.com/hashicorp/terraform-provider-azurerm/internal/features"
azValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/validate"
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk"
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation"
Expand Down Expand Up @@ -171,19 +170,6 @@ func resourceServiceBusTopicCreateUpdate(d *pluginsdk.ResourceData, meta interfa
enableBatchedOperations := d.Get("batched_operations_enabled").(bool)
enableExpress := d.Get("express_enabled").(bool)
enablePartitioning := d.Get("partitioning_enabled").(bool)
if !features.FourPointOh() {
if v := d.GetRawConfig().AsValueMap()["enable_batched_operations"]; !v.IsNull() {
enableBatchedOperations = d.Get("enable_batched_operations").(bool)
}

if v := d.GetRawConfig().AsValueMap()["enable_express"]; !v.IsNull() {
enableExpress = d.Get("enable_express").(bool)
}

if v := d.GetRawConfig().AsValueMap()["enable_partitioning"]; !v.IsNull() {
enablePartitioning = d.Get("enable_partitioning").(bool)
}
}

status := topics.EntityStatus(d.Get("status").(string))
parameters := topics.SBTopic{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (

"github.com/hashicorp/terraform-provider-azurerm/helpers/tf"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
"github.com/hashicorp/terraform-provider-azurerm/internal/features"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/migration"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/parse"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/validate"
Expand Down Expand Up @@ -74,17 +73,9 @@ func resourceSpringCloudGatewayRouteConfig() *pluginsdk.Resource {
},
},

// lintignore:S013
"protocol": {
Type: pluginsdk.TypeString,
Optional: !features.FourPointOh(),
Required: features.FourPointOh(),
Default: func() interface{} {
if !features.FourPointOh() {
return string(appplatform.GatewayRouteConfigProtocolHTTP)
}
return nil
}(),
Required: true,
ValidateFunc: validation.StringInSlice([]string{
string(appplatform.GatewayRouteConfigProtocolHTTP),
string(appplatform.GatewayRouteConfigProtocolHTTPS),
Expand Down
7 changes: 1 addition & 6 deletions internal/services/storage/storage_account_sas_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (

"github.com/hashicorp/go-azure-helpers/storage"
"github.com/hashicorp/terraform-provider-azurerm/helpers/validate"
"github.com/hashicorp/terraform-provider-azurerm/internal/features"
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk"
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation"
)
Expand All @@ -23,11 +22,7 @@ const (
// This is an ACCOUNT SAS : https://docs.microsoft.com/en-us/rest/api/storageservices/Constructing-an-Account-SAS
// not Service SAS
func dataSourceStorageAccountSharedAccessSignature() *pluginsdk.Resource {
sasSignedVersion := "2017-07-29"
if features.FourPointOhBeta() {
// TODO: Update the document as well
sasSignedVersion = "2022-11-02"
}
sasSignedVersion := "2022-11-02"
return &pluginsdk.Resource{
Read: dataSourceStorageAccountSasRead,

Expand Down
22 changes: 2 additions & 20 deletions internal/services/synapse/synapse_spark_pool_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"github.com/Azure/azure-sdk-for-go/services/preview/synapse/mgmt/v2.0/synapse" // nolint: staticcheck
"github.com/hashicorp/terraform-provider-azurerm/helpers/tf"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
"github.com/hashicorp/terraform-provider-azurerm/internal/features"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/synapse/parse"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/synapse/validate"
"github.com/hashicorp/terraform-provider-azurerm/internal/tags"
Expand All @@ -22,7 +21,7 @@ import (
)

func resourceSynapseSparkPool() *pluginsdk.Resource {
resource := &pluginsdk.Resource{
return &pluginsdk.Resource{
Create: resourceSynapseSparkPoolCreate,
Read: resourceSynapseSparkPoolRead,
Update: resourceSynapseSparkPoolUpdate,
Expand Down Expand Up @@ -215,11 +214,8 @@ func resourceSynapseSparkPool() *pluginsdk.Resource {

"spark_version": {
Type: pluginsdk.TypeString,
Optional: true,
Default: "2.4",
Required: true,
ValidateFunc: validation.StringInSlice([]string{
"2.4",
"3.1",
"3.2",
"3.3",
"3.4",
Expand All @@ -229,20 +225,6 @@ func resourceSynapseSparkPool() *pluginsdk.Resource {
"tags": tags.Schema(),
},
}

if features.FourPointOh() {
resource.Schema["spark_version"] = &pluginsdk.Schema{
Type: pluginsdk.TypeString,
Required: true,
ValidateFunc: validation.StringInSlice([]string{
"3.2",
"3.3",
"3.4",
}, false),
}
}

return resource
}

func resourceSynapseSparkPoolCreate(d *pluginsdk.ResourceData, meta interface{}) error {
Expand Down
82 changes: 1 addition & 81 deletions internal/services/synapse/synapse_workspace_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (
"github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account"
"github.com/hashicorp/terraform-provider-azurerm/helpers/tf"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
"github.com/hashicorp/terraform-provider-azurerm/internal/features"
keyVaultValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/validate"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/synapse/parse"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/synapse/validate"
Expand All @@ -39,7 +38,7 @@ const (
)

func resourceSynapseWorkspace() *pluginsdk.Resource {
resource := &pluginsdk.Resource{
return &pluginsdk.Resource{
Create: resourceSynapseWorkspaceCreate,
Read: resourceSynapseWorkspaceRead,
Update: resourceSynapseWorkspaceUpdate,
Expand Down Expand Up @@ -272,8 +271,6 @@ func resourceSynapseWorkspace() *pluginsdk.Resource {
"tags": tags.Schema(),
},
}

return resource
}

func resourceSynapseWorkspaceCreate(d *pluginsdk.ResourceData, meta interface{}) error {
Expand Down Expand Up @@ -473,8 +470,6 @@ func resourceSynapseWorkspaceRead(d *pluginsdk.ResourceData, meta interface{}) e

func resourceSynapseWorkspaceUpdate(d *pluginsdk.ResourceData, meta interface{}) error {
client := meta.(*clients.Client).Synapse.WorkspaceClient
aadAdminClient := meta.(*clients.Client).Synapse.WorkspaceAadAdminsClient
sqlAdminClient := meta.(*clients.Client).Synapse.WorkspaceSQLAadAdminsClient
azureADOnlyAuthenticationsClient := meta.(*clients.Client).Synapse.WorkspaceAzureADOnlyAuthenticationsClient
identitySQLControlClient := meta.(*clients.Client).Synapse.WorkspaceManagedIdentitySQLControlSettingsClient
ctx, cancel := timeouts.ForUpdate(meta.(*clients.Client).StopContext, d)
Expand Down Expand Up @@ -546,66 +541,6 @@ func resourceSynapseWorkspaceUpdate(d *pluginsdk.ResourceData, meta interface{})
}
}

if !features.FourPointOh() {
if d.HasChange("aad_admin") {
aadAdmin := expandArmWorkspaceAadAdminInfo(d.Get("aad_admin").([]interface{}))
if aadAdmin != nil {
if err := waitSynapseWorkspaceProvisioningState(ctx, client, id); err != nil {
return fmt.Errorf("failed waiting for updating %s: %+v", id, err)
}
workspaceAadAdminsCreateOrUpdateFuture, err := aadAdminClient.CreateOrUpdate(ctx, id.ResourceGroup, id.Name, *aadAdmin)
if err != nil {
return fmt.Errorf("updating Synapse Workspace %q Sql Admin (Resource Group %q): %+v", id.Name, id.ResourceGroup, err)
}

if err = workspaceAadAdminsCreateOrUpdateFuture.WaitForCompletionRef(ctx, client.Client); err != nil {
return fmt.Errorf("waiting on updating for Synapse Workspace %q Sql Admin (Resource Group %q): %+v", id.Name, id.ResourceGroup, err)
}
} else {
if err := waitSynapseWorkspaceProvisioningState(ctx, client, id); err != nil {
return fmt.Errorf("failed waiting for updating %s: %+v", id, err)
}
workspaceAadAdminsDeleteFuture, err := aadAdminClient.Delete(ctx, id.ResourceGroup, id.Name)
if err != nil {
return fmt.Errorf("setting empty Synapse Workspace %q Sql Admin (Resource Group %q): %+v", id.Name, id.ResourceGroup, err)
}

if err = workspaceAadAdminsDeleteFuture.WaitForCompletionRef(ctx, client.Client); err != nil {
return fmt.Errorf("waiting on setting empty Synapse Workspace %q Sql Admin (Resource Group %q): %+v", id.Name, id.ResourceGroup, err)
}
}
}

if d.HasChange("sql_aad_admin") {
sqlAdmin := expandArmWorkspaceAadAdminInfo(d.Get("sql_aad_admin").([]interface{}))
if sqlAdmin != nil {
if err := waitSynapseWorkspaceProvisioningState(ctx, client, id); err != nil {
return fmt.Errorf("failed waiting for updating %s: %+v", id, err)
}
workspaceSqlAdminsCreateOrUpdateFuture, err := sqlAdminClient.CreateOrUpdate(ctx, id.ResourceGroup, id.Name, *sqlAdmin)
if err != nil {
return fmt.Errorf("updating Synapse Workspace %q Sql Admin (Resource Group %q): %+v", id.Name, id.ResourceGroup, err)
}

if err = workspaceSqlAdminsCreateOrUpdateFuture.WaitForCompletionRef(ctx, client.Client); err != nil {
return fmt.Errorf("waiting on updating for Synapse Workspace %q Sql Admin (Resource Group %q): %+v", id.Name, id.ResourceGroup, err)
}
} else {
if err := waitSynapseWorkspaceProvisioningState(ctx, client, id); err != nil {
return fmt.Errorf("failed waiting for updating %s: %+v", id, err)
}
workspaceSqlAdminsDeleteFuture, err := sqlAdminClient.Delete(ctx, id.ResourceGroup, id.Name)
if err != nil {
return fmt.Errorf("setting empty Synapse Workspace %q Sql Admin (Resource Group %q): %+v", id.Name, id.ResourceGroup, err)
}

if err = workspaceSqlAdminsDeleteFuture.WaitForCompletionRef(ctx, client.Client); err != nil {
return fmt.Errorf("waiting on setting empty Synapse Workspace %q Sql Admin (Resource Group %q): %+v", id.Name, id.ResourceGroup, err)
}
}
}
}

if d.HasChange("sql_identity_control_enabled") {
sqlControlSettings := expandIdentityControlSQLSettings(d.Get("sql_identity_control_enabled").(bool))
if err := waitSynapseWorkspaceProvisioningState(ctx, client, id); err != nil {
Expand Down Expand Up @@ -734,21 +669,6 @@ func expandArmWorkspaceDataLakeStorageAccountDetails(storageDataLakeGen2Filesyst
}
}

func expandArmWorkspaceAadAdminInfo(input []interface{}) *synapse.WorkspaceAadAdminInfo {
if len(input) == 0 || input[0] == nil {
return nil
}
v := input[0].(map[string]interface{})
return &synapse.WorkspaceAadAdminInfo{
AadAdminProperties: &synapse.AadAdminProperties{
TenantID: utils.String(v["tenant_id"].(string)),
Login: utils.String(v["login"].(string)),
AdministratorType: utils.String("ActiveDirectory"),
Sid: utils.String(v["object_id"].(string)),
},
}
}

func expandWorkspaceRepositoryConfiguration(d *pluginsdk.ResourceData) *synapse.WorkspaceRepositoryConfiguration {
if azdoList, ok := d.GetOk("azure_devops_repo"); ok {
azdo := azdoList.([]interface{})[0].(map[string]interface{})
Expand Down
4 changes: 2 additions & 2 deletions website/docs/d/storage_account_sas.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ resource "azurerm_storage_account" "example" {
data "azurerm_storage_account_sas" "example" {
connection_string = azurerm_storage_account.example.primary_connection_string
https_only = true
signed_version = "2017-07-29"
signed_version = "2022-11-02"
resource_types {
service = true
Expand Down Expand Up @@ -81,7 +81,7 @@ output "sas_url_query_string" {
* `connection_string` - The connection string for the storage account to which this SAS applies. Typically directly from the `primary_connection_string` attribute of a terraform created `azurerm_storage_account` resource.
* `https_only` - (Optional) Only permit `https` access. If `false`, both `http` and `https` are permitted. Defaults to `true`.
* `ip_addresses` - (Optional) IP address, or a range of IP addresses, from which to accept requests. When specifying a range, note that the range is inclusive.
* `signed_version` - (Optional) Specifies the signed storage service version to use to authorize requests made with this account SAS. Defaults to `2017-07-29`.
* `signed_version` - (Optional) Specifies the signed storage service version to use to authorize requests made with this account SAS. Defaults to `2022-11-02`.
* `resource_types` - A `resource_types` block as defined below.
* `services` - A `services` block as defined below.
* `start` - The starting time and date of validity of this SAS. Must be a valid ISO-8601 format time/date string.
Expand Down
22 changes: 12 additions & 10 deletions website/docs/r/security_center_contact.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ subcategory: "Security Center"
layout: "azurerm"
page_title: "Azure Resource Manager: azurerm_security_center_contact"
description: |-
Manages the subscription's Security Center Contact.
Manages the subscription's Security Center Contact.
---

# azurerm_security_center_contact
Expand All @@ -25,7 +25,7 @@ resource "azurerm_security_center_contact" "example" {
}
```

## Argument Reference
## Arguments Reference

The following arguments are supported:

Expand All @@ -35,29 +35,31 @@ The following arguments are supported:

* `email` - (Required) The email of the Security Center Contact.

* `name` - (Optional) The name of the Security Center Contact. Defaults to `default1`.
* `name` - (Required) The name of the Security Center Contact. Changing this forces a new Security Center Contact to be created.

---

* `phone` - (Optional) The phone number of the Security Center Contact.

## Attributes Reference

In addition to the Arguments listed above - the following Attributes are exported:
In addition to the Arguments listed above - the following Attributes are exported:

* `id` - The Security Center Contact ID.
* `id` - The ID of the Security Center Contact.

## Timeouts

The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/language/resources/syntax#operation-timeouts) for certain actions:

* `create` - (Defaults to 60 minutes) Used when creating the Security Center Contact.
* `update` - (Defaults to 60 minutes) Used when updating the Security Center Contact.
* `create` - (Defaults to 1 hour) Used when creating the Security Center Contact.
* `read` - (Defaults to 5 minutes) Used when retrieving the Security Center Contact.
* `delete` - (Defaults to 60 minutes) Used when deleting the Security Center Contact.
* `update` - (Defaults to 1 hour) Used when updating the Security Center Contact.
* `delete` - (Defaults to 1 hour) Used when deleting the Security Center Contact.

## Import

The contact can be imported using the `resource id`, e.g.
Security Center Contacts can be imported using the `resource id`, e.g.

```shell
terraform import azurerm_security_center_contact.example /subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Security/securityContacts/default1
```
```
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ The following arguments are supported:

* `spring_cloud_gateway_id` - (Required) The ID of the Spring Cloud Gateway. Changing this forces a new Spring Cloud Gateway Route Config to be created.

* `protocol` - (Required) Specifies the protocol of routed Spring Cloud App. Allowed values are `HTTP` and `HTTPS`. Defaults to `HTTP`.
* `protocol` - (Required) Specifies the protocol of routed Spring Cloud App. Allowed values are `HTTP` and `HTTPS`.

~> **Note:** You likely want to use `HTTPS` in a production environment, since `HTTP` offers no encryption.

Expand Down
Loading

0 comments on commit 626f458

Please sign in to comment.