Skip to content

Commit e6dcfc2

Browse files
zexinwanocigovindrao55
authored andcommitted
add Renaming Analytics Service to HeatWave
1 parent 80ba8d3 commit e6dcfc2

19 files changed

+1200
-11
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
- Support for Maintenance Windows History in `database`
55
- Support save report in cost analysis
66
- Support for Capacity Reservations
7-
7+
- Support for Renaming Analytics Service to HeatWave
88
## 4.18.0 (March 17, 2021)
99

1010
### Added
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
// Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
2+
3+
variable "tenancy_ocid" {
4+
}
5+
6+
variable "user_ocid" {
7+
}
8+
9+
variable "fingerprint" {
10+
}
11+
12+
variable "private_key_path" {
13+
}
14+
15+
variable "region" {
16+
}
17+
18+
variable "compartment_ocid" {
19+
}
20+
21+
provider "oci" {
22+
tenancy_ocid = var.tenancy_ocid
23+
user_ocid = var.user_ocid
24+
fingerprint = var.fingerprint
25+
private_key_path = var.private_key_path
26+
region = var.region
27+
}
28+
29+
resource "oci_core_subnet" "test_subnet" {
30+
cidr_block = "10.0.0.0/24"
31+
compartment_id = var.compartment_ocid
32+
vcn_id = oci_core_vcn.test_vcn.id
33+
}
34+
35+
resource "oci_core_vcn" "test_vcn" {
36+
cidr_block = "10.0.0.0/16"
37+
compartment_id = var.compartment_ocid
38+
}
39+
40+
resource "oci_mysql_mysql_db_system" "test_mysql_db_system" {
41+
#Required
42+
admin_password = "BEstrO0ng_#11"
43+
admin_username = "adminUser"
44+
availability_domain = data.oci_identity_availability_domains.test_availability_domains.availability_domains[0].name
45+
compartment_id = var.compartment_ocid
46+
configuration_id = data.oci_mysql_mysql_configurations.test_mysql_configurations.configurations[0].id
47+
shape_name = "MySQL.HeatWave.VM.Standard.E3"
48+
subnet_id = oci_core_subnet.test_subnet.id
49+
data_storage_size_in_gb = "50"
50+
51+
#Optional
52+
backup_policy {
53+
is_enabled = "false"
54+
retention_in_days = "10"
55+
window_start_time = "01:00-00:00"
56+
}
57+
58+
#defined_tags = {"${oci_identity_tag_namespace.tag-namespace1.name}.${oci_identity_tag.tag1.name}" = "${var.mysql_defined_tags_value}"}
59+
#freeform_tags = var.mysql_freeform_tags
60+
description = "MySQL Database Service"
61+
62+
display_name = "HeatWave-DBSystem"
63+
fault_domain = "FAULT-DOMAIN-1"
64+
hostname_label = "hostnameLabel"
65+
ip_address = "10.0.0.8"
66+
67+
maintenance {
68+
window_start_time = "sun 01:00"
69+
}
70+
71+
port = "3306"
72+
port_x = "33306"
73+
}
74+
75+
resource "oci_mysql_heat_wave_cluster" "test_heat_wave_cluster" {
76+
db_system_id = oci_mysql_mysql_db_system.test_mysql_db_system.id
77+
cluster_size = "2"
78+
shape_name = "MySQL.HeatWave.VM.Standard.E3"
79+
}
80+
81+
data "oci_mysql_mysql_configurations" "test_mysql_configurations" {
82+
compartment_id = var.compartment_ocid
83+
84+
#Optional
85+
state = "ACTIVE"
86+
shape_name = "MySQL.HeatWave.VM.Standard.E3"
87+
}
88+
89+
data "oci_mysql_shapes" "test_shapes" {
90+
compartment_id = var.compartment_ocid
91+
availability_domain = lower(
92+
data.oci_identity_availability_domains.test_availability_domains.availability_domains[0].name,
93+
)
94+
}
95+
96+
data "oci_identity_availability_domains" "test_availability_domains" {
97+
compartment_id = var.tenancy_ocid
98+
}
99+
100+
output "configuration_id" {
101+
value = data.oci_mysql_mysql_configurations.test_mysql_configurations.configurations[0].id
102+
}
103+

examples/mysql/main.tf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ data "oci_mysql_mysql_configurations" "test_mysql_configurations" {
100100

101101
#Optional
102102
state = "ACTIVE"
103-
display_name = "VM.Standard.E2.2.Built-in"
104103
shape_name = "VM.Standard.E2.2"
105104
}
106105

oci/export_definitions.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1605,6 +1605,15 @@ var exportMonitoringAlarmHints = &TerraformResourceHints{
16051605
},
16061606
}
16071607

1608+
var exportMysqlHeatWaveClusterHints = &TerraformResourceHints{
1609+
resourceClass: "oci_mysql_heat_wave_cluster",
1610+
datasourceClass: "oci_mysql_heat_wave_cluster",
1611+
resourceAbbreviation: "heat_wave_cluster",
1612+
discoverableLifecycleStates: []string{
1613+
string(oci_mysql.HeatWaveClusterLifecycleStateActive),
1614+
},
1615+
}
1616+
16081617
var exportMysqlMysqlBackupHints = &TerraformResourceHints{
16091618
resourceClass: "oci_mysql_mysql_backup",
16101619
datasourceClass: "oci_mysql_mysql_backups",
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
// Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
2+
// Licensed under the Mozilla Public License v2.0
3+
4+
package oci
5+
6+
import (
7+
"context"
8+
9+
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
10+
oci_mysql "github.com/oracle/oci-go-sdk/v36/mysql"
11+
)
12+
13+
func init() {
14+
RegisterDatasource("oci_mysql_heat_wave_cluster", MysqlHeatWaveClusterDataSource())
15+
}
16+
17+
func MysqlHeatWaveClusterDataSource() *schema.Resource {
18+
fieldMap := make(map[string]*schema.Schema)
19+
fieldMap["db_system_id"] = &schema.Schema{
20+
Type: schema.TypeString,
21+
Required: true,
22+
}
23+
return GetSingularDataSourceItemSchema(MysqlHeatWaveClusterResource(), fieldMap, readSingularMysqlHeatWaveCluster)
24+
}
25+
26+
func readSingularMysqlHeatWaveCluster(d *schema.ResourceData, m interface{}) error {
27+
sync := &MysqlHeatWaveClusterDataSourceCrud{}
28+
sync.D = d
29+
sync.Client = m.(*OracleClients).dbSystemClient()
30+
31+
return ReadResource(sync)
32+
}
33+
34+
type MysqlHeatWaveClusterDataSourceCrud struct {
35+
D *schema.ResourceData
36+
Client *oci_mysql.DbSystemClient
37+
Res *oci_mysql.GetHeatWaveClusterResponse
38+
}
39+
40+
func (s *MysqlHeatWaveClusterDataSourceCrud) VoidState() {
41+
s.D.SetId("")
42+
}
43+
44+
func (s *MysqlHeatWaveClusterDataSourceCrud) Get() error {
45+
request := oci_mysql.GetHeatWaveClusterRequest{}
46+
47+
if dbSystemId, ok := s.D.GetOkExists("db_system_id"); ok {
48+
tmp := dbSystemId.(string)
49+
request.DbSystemId = &tmp
50+
}
51+
52+
request.RequestMetadata.RetryPolicy = getRetryPolicy(false, "mysql")
53+
54+
response, err := s.Client.GetHeatWaveCluster(context.Background(), request)
55+
if err != nil {
56+
return err
57+
}
58+
59+
s.Res = &response
60+
return nil
61+
}
62+
63+
func (s *MysqlHeatWaveClusterDataSourceCrud) SetData() error {
64+
if s.Res == nil {
65+
return nil
66+
}
67+
68+
s.D.SetId(GenerateDataSourceHashID("MysqlHeatWaveClusterDataSource-", MysqlHeatWaveClusterDataSource(), s.D))
69+
70+
clusterNodes := []interface{}{}
71+
for _, item := range s.Res.ClusterNodes {
72+
clusterNodes = append(clusterNodes, HeatWaveNodeToMap(item))
73+
}
74+
s.D.Set("cluster_nodes", clusterNodes)
75+
76+
if s.Res.ClusterSize != nil {
77+
s.D.Set("cluster_size", *s.Res.ClusterSize)
78+
}
79+
80+
if s.Res.LifecycleDetails != nil {
81+
s.D.Set("lifecycle_details", *s.Res.LifecycleDetails)
82+
}
83+
84+
if s.Res.ShapeName != nil {
85+
s.D.Set("shape_name", *s.Res.ShapeName)
86+
}
87+
88+
s.D.Set("state", s.Res.LifecycleState)
89+
90+
if s.Res.TimeCreated != nil {
91+
s.D.Set("time_created", s.Res.TimeCreated.String())
92+
}
93+
94+
if s.Res.TimeUpdated != nil {
95+
s.D.Set("time_updated", s.Res.TimeUpdated.String())
96+
}
97+
98+
return nil
99+
}

0 commit comments

Comments
 (0)