Skip to content

Commit 2f9ad7f

Browse files
committed
Add Oracle Database CloudExadataInfrastructureExascaleConfig support
1 parent 56a2662 commit 2f9ad7f

4 files changed

Lines changed: 135 additions & 0 deletions

File tree

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
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+
samples:
40+
- name: oracledatabase_cloud_exadata_infrastructure_exascale_config_basic
41+
primary_resource_id: my_exascale_config
42+
steps:
43+
- name: oracledatabase_cloud_exadata_infrastructure_exascale_config_basic
44+
resource_id_vars:
45+
project: my-project
46+
cloud_exadata_infrastructure_id: my-infra
47+
deletion_protection: true
48+
ignore_read_extra:
49+
- deletion_protection
50+
test_vars_overrides:
51+
deletion_protection: "false"
52+
project: '"oci-terraform-testing-prod"'
53+
cloud_exadata_infrastructure_id: fmt.Sprintf("ofake-test-tf-configured-exadata-%s", acctest.RandString(t, 10))
54+
55+
parameters:
56+
- name: project
57+
type: String
58+
required: true
59+
immutable: true
60+
url_param_only: true
61+
- name: location
62+
type: String
63+
required: true
64+
immutable: true
65+
url_param_only: true
66+
- name: cloudExadataInfrastructure
67+
type: ResourceRef
68+
required: true
69+
immutable: true
70+
url_param_only: true
71+
resource: CloudExadataInfrastructure
72+
imports: name
73+
74+
properties:
75+
- name: totalStorageSizeGb
76+
type: Integer
77+
required: true
78+
immutable: true
79+
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
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 $.ResourceIdVars "cloud_exadata_infrastructure_id"}}"
3+
display_name = "{{index $.ResourceIdVars "cloud_exadata_infrastructure_id"}} displayname"
4+
location = "us-east4"
5+
project = "{{index $.ResourceIdVars "project"}}"
6+
7+
properties {
8+
shape = "Exadata.X9M"
9+
compute_count = "2"
10+
storage_count = "3"
11+
}
12+
13+
deletion_protection = "{{index $.ResourceIdVars "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 $.ResourceIdVars "project"}}"
20+
total_storage_size_gb = 10240
21+
}

0 commit comments

Comments
 (0)