-
Notifications
You must be signed in to change notification settings - Fork 5k
Efedotov/2025 03 01 terraform azure rm for adbs cross region disaster recovery #30167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
a897961
5a30804
e794fc3
ca7b261
af34669
3094e55
619d5d1
e6c5dad
dfa1c16
59e7568
846b371
aa28dae
dfee32b
b7b0c69
63f98ca
21ee0a3
9c270c4
5e48d23
c98cd6a
a05b426
80c8e4a
1de8261
3b3723a
fb11058
1f946ce
92d4345
64284db
1fe038b
c7d6139
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| // Copyright (c) HashiCorp, Inc. | ||
| // SPDX-License-Identifier: MPL-2.0 | ||
|
|
||
| package oracle_test | ||
|
|
||
| import ( | ||
| "fmt" | ||
| "testing" | ||
|
|
||
| "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" | ||
| "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" | ||
| "github.com/hashicorp/terraform-provider-azurerm/internal/services/oracle" | ||
| ) | ||
|
|
||
| type AutonomousDatabaseCrossRegionDisasterRecoveryDataSource struct{} | ||
|
|
||
| func TestAccAutonomousDatabaseCrossRegionDisasterRecoveryDataSource_basic(t *testing.T) { | ||
| data := acceptance.BuildTestData(t, oracle.AutonomousDatabaseCrossRegionDisasterRecoveryDataSource{}.ResourceType(), "adbs_secondary_crdr") | ||
| r := AutonomousDatabaseCrossRegionDisasterRecoveryDataSource{} | ||
| data.DataSourceTest(t, []acceptance.TestStep{ | ||
| { | ||
| Config: r.basic(data), | ||
| Check: acceptance.ComposeTestCheckFunc( | ||
| check.That(data.ResourceName).Key("database_workload").Exists(), | ||
| check.That(data.ResourceName).Key("license_model").Exists(), | ||
| check.That(data.ResourceName).Key("remote_disaster_recovery_type").HasValue("Adg"), | ||
| check.That(data.ResourceName).Key("source_autonomous_database_id").Exists(), | ||
| check.That(data.ResourceName).Key("location").Exists(), | ||
| check.That(data.ResourceName).Key("name").Exists(), | ||
| ), | ||
| }, | ||
| }) | ||
| } | ||
|
|
||
| func (d AutonomousDatabaseCrossRegionDisasterRecoveryDataSource) basic(data acceptance.TestData) string { | ||
| return fmt.Sprintf(` | ||
| %s | ||
|
|
||
| data "azurerm_oracle_autonomous_database_cross_region_disaster_recovery" "adbs_secondary_crdr" { | ||
| name = azurerm_oracle_autonomous_database_cross_region_disaster_recovery.adbs_secondary_crdr.name | ||
| resource_group_name = azurerm_oracle_autonomous_database_cross_region_disaster_recovery.adbs_secondary_crdr.resource_group_name | ||
| } | ||
| `, AdbsCrossRegionDisasterRecoveryResource{}.complete(data)) | ||
| } |
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,341 @@ | ||||||||||||||
| // Copyright (c) HashiCorp, Inc. | ||||||||||||||
| // SPDX-License-Identifier: MPL-2.0 | ||||||||||||||
|
|
||||||||||||||
| package oracle | ||||||||||||||
|
|
||||||||||||||
| import ( | ||||||||||||||
| "context" | ||||||||||||||
| "fmt" | ||||||||||||||
| "time" | ||||||||||||||
|
|
||||||||||||||
| "github.com/hashicorp/go-azure-helpers/lang/pointer" | ||||||||||||||
| "github.com/hashicorp/go-azure-helpers/lang/response" | ||||||||||||||
| "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" | ||||||||||||||
| "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" | ||||||||||||||
| "github.com/hashicorp/go-azure-helpers/resourcemanager/location" | ||||||||||||||
| "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2025-09-01/autonomousdatabases" | ||||||||||||||
| "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" | ||||||||||||||
| "github.com/hashicorp/terraform-provider-azurerm/internal/services/oracle/validate" | ||||||||||||||
| "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" | ||||||||||||||
| ) | ||||||||||||||
|
|
||||||||||||||
| var _ sdk.Resource = AutonomousDatabaseCrossRegionDisasterRecoveryResource{} | ||||||||||||||
|
|
||||||||||||||
| type AutonomousDatabaseCrossRegionDisasterRecoveryResource struct{} | ||||||||||||||
|
|
||||||||||||||
| type AutonomousDatabaseCrossRegionDisasterRecoveryResourceModel struct { | ||||||||||||||
| Location string `tfschema:"location"` | ||||||||||||||
| Name string `tfschema:"name"` | ||||||||||||||
| ResourceGroupName string `tfschema:"resource_group_name"` | ||||||||||||||
| Tags map[string]string `tfschema:"tags"` | ||||||||||||||
| RemoteDisasterRecoveryType string `tfschema:"remote_disaster_recovery_type"` | ||||||||||||||
| SourceAutonomousDatabaseId string `tfschema:"source_autonomous_database_id"` | ||||||||||||||
| AutoScalingEnabled bool `tfschema:"auto_scaling_enabled"` | ||||||||||||||
| AutoScalingForStorageEnabled bool `tfschema:"auto_scaling_for_storage_enabled"` | ||||||||||||||
| BackupRetentionPeriodInDays int64 `tfschema:"backup_retention_period_in_days"` | ||||||||||||||
| CharacterSet string `tfschema:"character_set"` | ||||||||||||||
| ComputeCount float64 `tfschema:"compute_count"` | ||||||||||||||
| ComputeModel string `tfschema:"compute_model"` | ||||||||||||||
| DataStorageSizeInTb int64 `tfschema:"data_storage_size_in_tb"` | ||||||||||||||
| DatabaseVersion string `tfschema:"database_version"` | ||||||||||||||
| DatabaseWorkload string `tfschema:"database_workload"` | ||||||||||||||
| DisplayName string `tfschema:"display_name"` | ||||||||||||||
| LicenseModel string `tfschema:"license_model"` | ||||||||||||||
| MtlsConnectionRequired bool `tfschema:"mtls_connection_required"` | ||||||||||||||
| NationalCharacterSet string `tfschema:"national_character_set"` | ||||||||||||||
| SubnetId string `tfschema:"subnet_id"` | ||||||||||||||
| VnetId string `tfschema:"virtual_network_id"` | ||||||||||||||
|
|
||||||||||||||
| // Optional | ||||||||||||||
| CustomerContacts []string `tfschema:"customer_contacts"` | ||||||||||||||
| ReplicateAutomaticBackupsEnabled bool `tfschema:"replicate_automatic_backups_enabled"` | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| func (AutonomousDatabaseCrossRegionDisasterRecoveryResource) Arguments() map[string]*pluginsdk.Schema { | ||||||||||||||
| return map[string]*pluginsdk.Schema{ | ||||||||||||||
| "location": commonschema.Location(), | ||||||||||||||
|
|
||||||||||||||
| "name": { | ||||||||||||||
| Type: pluginsdk.TypeString, | ||||||||||||||
| Required: true, | ||||||||||||||
| ValidateFunc: validate.AutonomousDatabaseName, | ||||||||||||||
| ForceNew: true, | ||||||||||||||
| }, | ||||||||||||||
|
|
||||||||||||||
| "resource_group_name": commonschema.ResourceGroupName(), | ||||||||||||||
|
|
||||||||||||||
| "display_name": { | ||||||||||||||
| Type: pluginsdk.TypeString, | ||||||||||||||
| Required: true, | ||||||||||||||
| ForceNew: true, | ||||||||||||||
| ValidateFunc: validate.AutonomousDatabaseName, | ||||||||||||||
| }, | ||||||||||||||
|
|
||||||||||||||
| // Cross Region Disaster Recovery | ||||||||||||||
| // Required | ||||||||||||||
|
|
||||||||||||||
| "source_autonomous_database_id": commonschema.ResourceIDReferenceRequiredForceNew(&autonomousdatabases.AutonomousDatabaseId{}), | ||||||||||||||
|
|
||||||||||||||
| "subnet_id": { | ||||||||||||||
| Type: pluginsdk.TypeString, | ||||||||||||||
| Required: true, | ||||||||||||||
| ForceNew: true, | ||||||||||||||
| ValidateFunc: commonids.ValidateSubnetID, | ||||||||||||||
| }, | ||||||||||||||
|
|
||||||||||||||
| "virtual_network_id": { | ||||||||||||||
| Type: pluginsdk.TypeString, | ||||||||||||||
| Required: true, | ||||||||||||||
| ForceNew: true, | ||||||||||||||
| ValidateFunc: commonids.ValidateVirtualNetworkID, | ||||||||||||||
| }, | ||||||||||||||
|
|
||||||||||||||
| // Optional | ||||||||||||||
| "replicate_automatic_backups_enabled": { | ||||||||||||||
| Type: pluginsdk.TypeBool, | ||||||||||||||
| Optional: true, | ||||||||||||||
| Computed: true, | ||||||||||||||
| }, | ||||||||||||||
|
|
||||||||||||||
| "tags": commonschema.TagsForceNew(), | ||||||||||||||
| } | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| func (AutonomousDatabaseCrossRegionDisasterRecoveryResource) Attributes() map[string]*pluginsdk.Schema { | ||||||||||||||
| return map[string]*pluginsdk.Schema{ | ||||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please reorder the fields with the guidance
|
||||||||||||||
| "remote_disaster_recovery_type": { | ||||||||||||||
| Type: pluginsdk.TypeString, | ||||||||||||||
| Computed: true, | ||||||||||||||
| }, | ||||||||||||||
| "auto_scaling_enabled": { | ||||||||||||||
| Type: pluginsdk.TypeBool, | ||||||||||||||
| Computed: true, | ||||||||||||||
| }, | ||||||||||||||
| "auto_scaling_for_storage_enabled": { | ||||||||||||||
| Type: pluginsdk.TypeBool, | ||||||||||||||
| Computed: true, | ||||||||||||||
| }, | ||||||||||||||
| "backup_retention_period_in_days": { | ||||||||||||||
| Type: pluginsdk.TypeInt, | ||||||||||||||
| Computed: true, | ||||||||||||||
| }, | ||||||||||||||
| "character_set": { | ||||||||||||||
| Type: pluginsdk.TypeString, | ||||||||||||||
| Computed: true, | ||||||||||||||
| }, | ||||||||||||||
| "compute_count": { | ||||||||||||||
| Type: pluginsdk.TypeFloat, | ||||||||||||||
| Computed: true, | ||||||||||||||
| }, | ||||||||||||||
| "compute_model": { | ||||||||||||||
| Type: pluginsdk.TypeString, | ||||||||||||||
| Computed: true, | ||||||||||||||
| }, | ||||||||||||||
| "customer_contacts": { | ||||||||||||||
| Type: pluginsdk.TypeList, | ||||||||||||||
| Computed: true, | ||||||||||||||
| Elem: &pluginsdk.Schema{Type: pluginsdk.TypeString}, | ||||||||||||||
| }, | ||||||||||||||
| "data_storage_size_in_tb": { | ||||||||||||||
| Type: pluginsdk.TypeInt, | ||||||||||||||
| Computed: true, | ||||||||||||||
| }, | ||||||||||||||
| "database_version": { | ||||||||||||||
| Type: pluginsdk.TypeString, | ||||||||||||||
| Computed: true, | ||||||||||||||
| }, | ||||||||||||||
| "database_workload": { | ||||||||||||||
| Type: pluginsdk.TypeString, | ||||||||||||||
| Computed: true, | ||||||||||||||
| }, | ||||||||||||||
| "license_model": { | ||||||||||||||
| Type: pluginsdk.TypeString, | ||||||||||||||
| Computed: true, | ||||||||||||||
| }, | ||||||||||||||
| "mtls_connection_required": { | ||||||||||||||
| Type: pluginsdk.TypeBool, | ||||||||||||||
| Computed: true, | ||||||||||||||
| }, | ||||||||||||||
| "national_character_set": { | ||||||||||||||
| Type: pluginsdk.TypeString, | ||||||||||||||
| Computed: true, | ||||||||||||||
| }, | ||||||||||||||
| } | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| func (AutonomousDatabaseCrossRegionDisasterRecoveryResource) ModelObject() interface{} { | ||||||||||||||
| return &AutonomousDatabaseCrossRegionDisasterRecoveryResourceModel{} | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| func (AutonomousDatabaseCrossRegionDisasterRecoveryResource) ResourceType() string { | ||||||||||||||
| return "azurerm_oracle_autonomous_database_cross_region_disaster_recovery" | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| func (r AutonomousDatabaseCrossRegionDisasterRecoveryResource) Create() sdk.ResourceFunc { | ||||||||||||||
| return sdk.ResourceFunc{ | ||||||||||||||
| Timeout: 120 * time.Minute, | ||||||||||||||
| Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { | ||||||||||||||
| client := metadata.Client.Oracle.OracleClient.AutonomousDatabases | ||||||||||||||
| subscriptionId := metadata.Client.Account.SubscriptionId | ||||||||||||||
|
|
||||||||||||||
| var model AutonomousDatabaseCrossRegionDisasterRecoveryResourceModel | ||||||||||||||
| if err := metadata.Decode(&model); err != nil { | ||||||||||||||
| return fmt.Errorf("decoding: %+v", err) | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| id := autonomousdatabases.NewAutonomousDatabaseID(subscriptionId, | ||||||||||||||
| model.ResourceGroupName, | ||||||||||||||
| model.Name) | ||||||||||||||
|
|
||||||||||||||
| existing, err := client.Get(ctx, id) | ||||||||||||||
| if err != nil && !response.WasNotFound(existing.HttpResponse) { | ||||||||||||||
| return fmt.Errorf("checking for presence of existing %s: %+v", id, err) | ||||||||||||||
| } | ||||||||||||||
| if !response.WasNotFound(existing.HttpResponse) { | ||||||||||||||
| return metadata.ResourceRequiresImport(r.ResourceType(), id) | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| sourceId, err := autonomousdatabases.ParseAutonomousDatabaseID(model.SourceAutonomousDatabaseId) | ||||||||||||||
| if err != nil { | ||||||||||||||
| return err | ||||||||||||||
| } | ||||||||||||||
| sourceDb, err := client.Get(ctx, *sourceId) | ||||||||||||||
| if err != nil { | ||||||||||||||
| return fmt.Errorf("fetching source DB: %+v", err) | ||||||||||||||
| } | ||||||||||||||
|
Comment on lines
+203
to
+205
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For consistency could you update this err msg to:
Suggested change
|
||||||||||||||
| if sourceDb.Model == nil { | ||||||||||||||
| return fmt.Errorf("retrieving %s: `model` was nil", sourceId) | ||||||||||||||
| } | ||||||||||||||
|
Comment on lines
+206
to
+208
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||
| if sourceDb.Model.Properties == nil { | ||||||||||||||
| return fmt.Errorf("retrieving %s: `properties` was nil", sourceId) | ||||||||||||||
| } | ||||||||||||||
| normalizedLocation := location.Normalize(model.Location) | ||||||||||||||
| sourceLocation := location.Normalize(sourceDb.Model.Location) | ||||||||||||||
| if normalizedLocation == sourceLocation { | ||||||||||||||
| return fmt.Errorf("disaster Recovery database must reside in a different region from the source database (source is '%s', target is '%s')", sourceLocation, model.Location) | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| sourceProps, ok := sourceDb.Model.Properties.(autonomousdatabases.AutonomousDatabaseProperties) | ||||||||||||||
| if !ok { | ||||||||||||||
| return fmt.Errorf("retrieving %s: `properties` was not of type `AutonomousDatabaseProperties`", sourceId) | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| param := autonomousdatabases.AutonomousDatabase{ | ||||||||||||||
| Name: pointer.To(model.Name), | ||||||||||||||
| Location: normalizedLocation, | ||||||||||||||
| Tags: pointer.To(model.Tags), | ||||||||||||||
| Properties: &autonomousdatabases.AutonomousDatabaseCrossRegionDisasterRecoveryProperties{ | ||||||||||||||
| Source: autonomousdatabases.SourceCrossRegionDisasterRecovery, | ||||||||||||||
| SourceId: model.SourceAutonomousDatabaseId, | ||||||||||||||
| SourceOcid: sourceProps.Ocid, | ||||||||||||||
| SourceLocation: pointer.To(sourceLocation), | ||||||||||||||
| RemoteDisasterRecoveryType: autonomousdatabases.DisasterRecoveryTypeAdg, | ||||||||||||||
| IsReplicateAutomaticBackups: pointer.To(model.ReplicateAutomaticBackupsEnabled), | ||||||||||||||
| AdminPassword: sourceProps.AdminPassword, | ||||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Based on the autonomous database resource, this field is not returned by the API. I see 3 potential scenarios here:
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is number 2 case and I am addressing it .
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this comment is not resolved? |
||||||||||||||
| BackupRetentionPeriodInDays: sourceProps.BackupRetentionPeriodInDays, | ||||||||||||||
| CharacterSet: sourceProps.CharacterSet, | ||||||||||||||
| ComputeCount: sourceProps.ComputeCount, | ||||||||||||||
| ComputeModel: sourceProps.ComputeModel, | ||||||||||||||
| CustomerContacts: sourceProps.CustomerContacts, | ||||||||||||||
| DataBaseType: autonomousdatabases.DataBaseTypeCrossRegionDisasterRecovery, | ||||||||||||||
| DataStorageSizeInTbs: sourceProps.DataStorageSizeInTbs, | ||||||||||||||
| DbWorkload: sourceProps.DbWorkload, | ||||||||||||||
| DbVersion: sourceProps.DbVersion, | ||||||||||||||
| DisplayName: pointer.To(model.DisplayName), | ||||||||||||||
| IsAutoScalingEnabled: sourceProps.IsAutoScalingEnabled, | ||||||||||||||
| IsAutoScalingForStorageEnabled: sourceProps.IsAutoScalingForStorageEnabled, | ||||||||||||||
| IsMtlsConnectionRequired: sourceProps.IsMtlsConnectionRequired, | ||||||||||||||
| LicenseModel: sourceProps.LicenseModel, | ||||||||||||||
| NcharacterSet: sourceProps.NcharacterSet, | ||||||||||||||
| SubnetId: pointer.To(model.SubnetId), | ||||||||||||||
| VnetId: pointer.To(model.VnetId), | ||||||||||||||
| }, | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| if err := client.CreateOrUpdateThenPoll(ctx, id, param); err != nil { | ||||||||||||||
| return fmt.Errorf("creating %s: %+v", id, err) | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| metadata.SetID(id) | ||||||||||||||
| return nil | ||||||||||||||
| }, | ||||||||||||||
| } | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| func (AutonomousDatabaseCrossRegionDisasterRecoveryResource) Read() sdk.ResourceFunc { | ||||||||||||||
| return sdk.ResourceFunc{ | ||||||||||||||
| Timeout: 5 * time.Minute, | ||||||||||||||
| Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { | ||||||||||||||
| id, err := autonomousdatabases.ParseAutonomousDatabaseID(metadata.ResourceData.Id()) | ||||||||||||||
| if err != nil { | ||||||||||||||
| return err | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| client := metadata.Client.Oracle.OracleClient.AutonomousDatabases | ||||||||||||||
| result, err := client.Get(ctx, *id) | ||||||||||||||
| if err != nil { | ||||||||||||||
| if response.WasNotFound(result.HttpResponse) { | ||||||||||||||
| return metadata.MarkAsGone(id) | ||||||||||||||
| } | ||||||||||||||
| return fmt.Errorf("retrieving %s: %+v", id, err) | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| state := AutonomousDatabaseCrossRegionDisasterRecoveryResourceModel{ | ||||||||||||||
| Name: id.AutonomousDatabaseName, | ||||||||||||||
| ResourceGroupName: id.ResourceGroupName, | ||||||||||||||
| } | ||||||||||||||
| if model := result.Model; model != nil { | ||||||||||||||
| props, ok := model.Properties.(autonomousdatabases.AutonomousDatabaseCrossRegionDisasterRecoveryProperties) | ||||||||||||||
| if !ok { | ||||||||||||||
| return fmt.Errorf("%s was not of type `CrossRegionDisasterRecovery`", id) | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| state.ReplicateAutomaticBackupsEnabled = pointer.From(props.IsReplicateAutomaticBackups) | ||||||||||||||
| state.RemoteDisasterRecoveryType = string(props.RemoteDisasterRecoveryType) | ||||||||||||||
| state.SourceAutonomousDatabaseId = props.SourceId | ||||||||||||||
| state.AutoScalingEnabled = pointer.From(props.IsAutoScalingEnabled) | ||||||||||||||
| state.BackupRetentionPeriodInDays = pointer.From(props.BackupRetentionPeriodInDays) | ||||||||||||||
| state.AutoScalingForStorageEnabled = pointer.From(props.IsAutoScalingForStorageEnabled) | ||||||||||||||
| state.CharacterSet = pointer.From(props.CharacterSet) | ||||||||||||||
| state.ComputeCount = pointer.From(props.ComputeCount) | ||||||||||||||
| state.ComputeModel = pointer.FromEnum(props.ComputeModel) | ||||||||||||||
| state.CustomerContacts = flattenAdbsCustomerContacts(props.CustomerContacts) | ||||||||||||||
| state.DataStorageSizeInTb = pointer.From(props.DataStorageSizeInTbs) | ||||||||||||||
| state.DatabaseWorkload = pointer.FromEnum(props.DbWorkload) | ||||||||||||||
| state.DatabaseVersion = pointer.From(props.DbVersion) | ||||||||||||||
| state.DisplayName = pointer.From(props.DisplayName) | ||||||||||||||
| state.LicenseModel = pointer.FromEnum(props.LicenseModel) | ||||||||||||||
| state.Location = location.Normalize(model.Location) | ||||||||||||||
| state.NationalCharacterSet = pointer.From(props.NcharacterSet) | ||||||||||||||
| state.SubnetId = pointer.From(props.SubnetId) | ||||||||||||||
| state.Tags = pointer.From(result.Model.Tags) | ||||||||||||||
| state.VnetId = pointer.From(props.VnetId) | ||||||||||||||
| } | ||||||||||||||
| return metadata.Encode(&state) | ||||||||||||||
| }, | ||||||||||||||
| } | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| func (AutonomousDatabaseCrossRegionDisasterRecoveryResource) Delete() sdk.ResourceFunc { | ||||||||||||||
| return sdk.ResourceFunc{ | ||||||||||||||
| Timeout: 30 * time.Minute, | ||||||||||||||
| Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { | ||||||||||||||
| client := metadata.Client.Oracle.OracleClient.AutonomousDatabases | ||||||||||||||
|
|
||||||||||||||
| id, err := autonomousdatabases.ParseAutonomousDatabaseID(metadata.ResourceData.Id()) | ||||||||||||||
| if err != nil { | ||||||||||||||
| return err | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| if err = client.DeleteThenPoll(ctx, *id); err != nil { | ||||||||||||||
| return fmt.Errorf("deleting %s: %+v", id, err) | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| return nil | ||||||||||||||
| }, | ||||||||||||||
| } | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| func (AutonomousDatabaseCrossRegionDisasterRecoveryResource) IDValidationFunc() pluginsdk.SchemaValidateFunc { | ||||||||||||||
| return autonomousdatabases.ValidateAutonomousDatabaseID | ||||||||||||||
| } | ||||||||||||||

There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please reorder the fields with the guidance