Skip to content

Commit d715fb7

Browse files
committed
Add Oracle Database CloudExadataInfrastructureExascaleConfig support
1 parent ebfbd8f commit d715fb7

4 files changed

Lines changed: 133 additions & 0 deletions
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# Copyright 2026 Google Inc.
2+
# Licensed under the Apache License, Version 2.0 (the "License");
3+
# you may not use this file except in compliance with the License.
4+
# You may obtain a copy of the License at
5+
#
6+
# http://www.apache.org/licenses/LICENSE-2.0
7+
#
8+
# Unless required by applicable law or agreed to in writing, software
9+
# distributed under the License is distributed on an "AS IS" BASIS,
10+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
# See the License for the specific language governing permissions and
12+
# limitations under the License.
13+
14+
---
15+
name: CloudExadataInfrastructureExascaleConfig
16+
description: |
17+
A resource to configure Exascale storage on an Oracle Cloud Exadata Infrastructure.
18+
self_link: '{{cloud_exadata_infrastructure}}'
19+
id_format: '{{cloud_exadata_infrastructure}}'
20+
import_format:
21+
- 'projects/{{project}}/locations/{{location}}/cloudExadataInfrastructures/{{cloud_exadata_infrastructure}}'
22+
create_url: '{{cloud_exadata_infrastructure}}:configureExascale'
23+
create_verb: POST
24+
immutable: true
25+
26+
autogen_async: true
27+
async:
28+
actions: ['create']
29+
type: OpAsync
30+
operation:
31+
base_url: '{{op_id}}'
32+
include_project: true
33+
34+
custom_code:
35+
custom_delete: templates/terraform/custom_delete/only_remove_from_state.go.tmpl
36+
decoder: templates/terraform/decoders/oracledatabase_cloud_exadata_infrastructure_exascale_config.go.tmpl
37+
custom_import: templates/terraform/custom_import/oracledatabase_cloud_exadata_infrastructure_exascale_config.go.tmpl
38+
39+
examples:
40+
- name: oracledatabase_cloud_exadata_infrastructure_exascale_config_basic
41+
primary_resource_id: "my_exascale_config"
42+
vars:
43+
project: "my-project"
44+
cloud_exadata_infrastructure_id: "my-infra"
45+
deletion_protection: true
46+
ignore_read_extra:
47+
- "deletion_protection"
48+
test_vars_overrides:
49+
"deletion_protection": "false"
50+
"project": '"oci-terraform-testing-prod"'
51+
cloud_exadata_infrastructure_id: 'fmt.Sprintf("ofake-test-tf-configured-exadata-%s", acctest.RandString(t, 10))'
52+
53+
parameters:
54+
- name: project
55+
type: String
56+
required: true
57+
immutable: true
58+
url_param_only: true
59+
- name: location
60+
type: String
61+
required: true
62+
immutable: true
63+
url_param_only: true
64+
- name: cloudExadataInfrastructure
65+
type: ResourceRef
66+
required: true
67+
immutable: true
68+
url_param_only: true
69+
resource: CloudExadataInfrastructure
70+
imports: name
71+
72+
properties:
73+
- name: totalStorageSizeGb
74+
type: Integer
75+
required: true
76+
immutable: true
77+
description: "The total storage to be allocated to Exascale in GBs."
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
config := meta.(*transport_tpg.Config)
2+
3+
// Parse the import ID into project, location and the short name of the exadata infrastructure
4+
if err := tpgresource.ParseImportId([]string{
5+
"projects/(?P<project>[^/]+)/locations/(?P<location>[^/]+)/cloudExadataInfrastructures/(?P<cloud_exadata_infrastructure>[^/]+)",
6+
}, d, config); err != nil {
7+
return nil, err
8+
}
9+
10+
// Construct the full path and set it back on cloud_exadata_infrastructure
11+
project := d.Get("project").(string)
12+
location := d.Get("location").(string)
13+
infraShort := d.Get("cloud_exadata_infrastructure").(string)
14+
15+
infraLong := fmt.Sprintf("projects/%s/locations/%s/cloudExadataInfrastructures/%s", project, location, infraShort)
16+
if err := d.Set("cloud_exadata_infrastructure", infraLong); err != nil {
17+
return nil, fmt.Errorf("Error setting cloud_exadata_infrastructure: %s", err)
18+
}
19+
20+
d.SetId(infraLong)
21+
22+
return []*schema.ResourceData{d}, nil
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
properties, ok := res["properties"].(map[string]interface{})
2+
if !ok || properties == nil {
3+
return nil, fmt.Errorf("properties not found in response")
4+
}
5+
6+
exascaleConfig, ok := properties["exascaleConfig"].(map[string]interface{})
7+
if !ok || exascaleConfig == nil {
8+
return nil, nil
9+
}
10+
11+
res["totalStorageSizeGb"] = exascaleConfig["totalStorageSizeGb"]
12+
13+
return res, nil
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
resource "google_oracle_database_cloud_exadata_infrastructure" "infra" {
2+
cloud_exadata_infrastructure_id = "{{index $.Vars "cloud_exadata_infrastructure_id"}}"
3+
display_name = "{{index $.Vars "cloud_exadata_infrastructure_id"}} displayname"
4+
location = "us-east4"
5+
project = "{{index $.Vars "project"}}"
6+
7+
properties {
8+
shape = "Exadata.X9M"
9+
compute_count = "2"
10+
storage_count = "3"
11+
}
12+
13+
deletion_protection = "{{index $.Vars "deletion_protection"}}"
14+
}
15+
16+
resource "google_oracle_database_cloud_exadata_infrastructure_exascale_config" "{{$.PrimaryResourceId}}" {
17+
cloud_exadata_infrastructure = google_oracle_database_cloud_exadata_infrastructure.infra.name
18+
location = "us-east4"
19+
project = "{{index $.Vars "project"}}"
20+
total_storage_size_gb = 10240
21+
}

0 commit comments

Comments
 (0)