-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
azurerm_mssql_server_transparent_data_encryption
- Support for auto…
…rotation of KV keys (#18523)
- Loading branch information
Showing
4 changed files
with
117 additions
and
8 deletions.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
internal/services/mssql/migration/server_transparent_data_encryption_v0_to_v1.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package migration | ||
|
||
import ( | ||
"context" | ||
"log" | ||
|
||
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" | ||
) | ||
|
||
// Default: false for `auto_rotation_enabled` | ||
|
||
var _ pluginsdk.StateUpgrade = MsSqlTransparentDataEncryptionV0ToV1{} | ||
|
||
type MsSqlTransparentDataEncryptionV0ToV1 struct{} | ||
|
||
func (d MsSqlTransparentDataEncryptionV0ToV1) Schema() map[string]*pluginsdk.Schema { | ||
return map[string]*pluginsdk.Schema{ | ||
"server_id": { | ||
Type: pluginsdk.TypeString, | ||
Required: true, | ||
ForceNew: true, | ||
}, | ||
|
||
"key_vault_key_id": { | ||
Type: pluginsdk.TypeString, | ||
Optional: true, | ||
}, | ||
} | ||
} | ||
|
||
func (d MsSqlTransparentDataEncryptionV0ToV1) UpgradeFunc() pluginsdk.StateUpgraderFunc { | ||
return func(ctx context.Context, rawState map[string]interface{}, meta interface{}) (map[string]interface{}, error) { | ||
log.Printf("[DEBUG] Upgrading from Transparent Data Encryption V0 to V1..") | ||
existing := rawState["auto_rotation_enabled"] | ||
if existing == nil { | ||
log.Printf("[DEBUG] Setting `auto_rotation_enabled` to `false`") | ||
rawState["auto_rotation_enabled"] = false | ||
} | ||
|
||
log.Printf("[DEBUG] Upgraded from Transparent Data Encryption V0 to V1..") | ||
return rawState, nil | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters