diff --git a/mmv1/products/oracledatabase/CloudExadataInfrastructureExascaleConfig.yaml b/mmv1/products/oracledatabase/CloudExadataInfrastructureExascaleConfig.yaml new file mode 100644 index 000000000000..b3725b199d5f --- /dev/null +++ b/mmv1/products/oracledatabase/CloudExadataInfrastructureExascaleConfig.yaml @@ -0,0 +1,77 @@ +# Copyright 2026 Google Inc. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +--- +name: CloudExadataInfrastructureExascaleConfig +description: | + A resource to configure Exascale storage on an Oracle Cloud Exadata Infrastructure. +self_link: '{{cloud_exadata_infrastructure}}' +id_format: '{{cloud_exadata_infrastructure}}' +import_format: + - 'projects/{{project}}/locations/{{location}}/cloudExadataInfrastructures/{{cloud_exadata_infrastructure}}' +create_url: '{{cloud_exadata_infrastructure}}:configureExascale' +create_verb: POST +immutable: true + +autogen_async: true +async: + actions: ['create'] + type: OpAsync + operation: + base_url: '{{op_id}}' + include_project: true + +custom_code: + custom_delete: templates/terraform/custom_delete/only_remove_from_state.go.tmpl + decoder: templates/terraform/decoders/oracledatabase_cloud_exadata_infrastructure_exascale_config.go.tmpl + custom_import: templates/terraform/custom_import/oracledatabase_cloud_exadata_infrastructure_exascale_config.go.tmpl + +examples: + - name: oracledatabase_cloud_exadata_infrastructure_exascale_config_basic + primary_resource_id: "my_exascale_config" + vars: + project: "my-project" + cloud_exadata_infrastructure_id: "my-infra" + deletion_protection: true + ignore_read_extra: + - "deletion_protection" + test_vars_overrides: + "deletion_protection": "false" + "project": '"oci-terraform-testing-prod"' + cloud_exadata_infrastructure_id: 'fmt.Sprintf("ofake-test-tf-configured-exadata-%s", acctest.RandString(t, 10))' + +parameters: + - name: project + type: String + required: true + immutable: true + url_param_only: true + - name: location + type: String + required: true + immutable: true + url_param_only: true + - name: cloudExadataInfrastructure + type: ResourceRef + required: true + immutable: true + url_param_only: true + resource: CloudExadataInfrastructure + imports: name + +properties: + - name: totalStorageSizeGb + type: Integer + required: true + immutable: true + description: "The total storage to be allocated to Exascale in GBs." diff --git a/mmv1/templates/terraform/custom_import/oracledatabase_cloud_exadata_infrastructure_exascale_config.go.tmpl b/mmv1/templates/terraform/custom_import/oracledatabase_cloud_exadata_infrastructure_exascale_config.go.tmpl new file mode 100644 index 000000000000..2938824c9e19 --- /dev/null +++ b/mmv1/templates/terraform/custom_import/oracledatabase_cloud_exadata_infrastructure_exascale_config.go.tmpl @@ -0,0 +1,22 @@ +config := meta.(*transport_tpg.Config) + +// Parse the import ID into project, location and the short name of the exadata infrastructure +if err := tpgresource.ParseImportId([]string{ + "projects/(?P[^/]+)/locations/(?P[^/]+)/cloudExadataInfrastructures/(?P[^/]+)", +}, d, config); err != nil { + return nil, err +} + +// Construct the full path and set it back on cloud_exadata_infrastructure +project := d.Get("project").(string) +location := d.Get("location").(string) +infraShort := d.Get("cloud_exadata_infrastructure").(string) + +infraLong := fmt.Sprintf("projects/%s/locations/%s/cloudExadataInfrastructures/%s", project, location, infraShort) +if err := d.Set("cloud_exadata_infrastructure", infraLong); err != nil { + return nil, fmt.Errorf("Error setting cloud_exadata_infrastructure: %s", err) +} + +d.SetId(infraLong) + +return []*schema.ResourceData{d}, nil diff --git a/mmv1/templates/terraform/decoders/oracledatabase_cloud_exadata_infrastructure_exascale_config.go.tmpl b/mmv1/templates/terraform/decoders/oracledatabase_cloud_exadata_infrastructure_exascale_config.go.tmpl new file mode 100644 index 000000000000..444068c18afc --- /dev/null +++ b/mmv1/templates/terraform/decoders/oracledatabase_cloud_exadata_infrastructure_exascale_config.go.tmpl @@ -0,0 +1,13 @@ +properties, ok := res["properties"].(map[string]interface{}) +if !ok || properties == nil { + return nil, fmt.Errorf("properties not found in response") +} + +exascaleConfig, ok := properties["exascaleConfig"].(map[string]interface{}) +if !ok || exascaleConfig == nil { + return nil, nil +} + +res["totalStorageSizeGb"] = exascaleConfig["totalStorageSizeGb"] + +return res, nil diff --git a/mmv1/templates/terraform/examples/oracledatabase_cloud_exadata_infrastructure_exascale_config_basic.tf.tmpl b/mmv1/templates/terraform/examples/oracledatabase_cloud_exadata_infrastructure_exascale_config_basic.tf.tmpl new file mode 100644 index 000000000000..a4aeee5b9bfd --- /dev/null +++ b/mmv1/templates/terraform/examples/oracledatabase_cloud_exadata_infrastructure_exascale_config_basic.tf.tmpl @@ -0,0 +1,21 @@ +resource "google_oracle_database_cloud_exadata_infrastructure" "infra" { + cloud_exadata_infrastructure_id = "{{index $.Vars "cloud_exadata_infrastructure_id"}}" + display_name = "{{index $.Vars "cloud_exadata_infrastructure_id"}} displayname" + location = "us-east4" + project = "{{index $.Vars "project"}}" + + properties { + shape = "Exadata.X9M" + compute_count = "2" + storage_count = "3" + } + + deletion_protection = "{{index $.Vars "deletion_protection"}}" +} + +resource "google_oracle_database_cloud_exadata_infrastructure_exascale_config" "{{$.PrimaryResourceId}}" { + cloud_exadata_infrastructure = google_oracle_database_cloud_exadata_infrastructure.infra.name + location = "us-east4" + project = "{{index $.Vars "project"}}" + total_storage_size_gb = 10240 +}