@@ -56,18 +56,6 @@ func ResourceOracleDatabaseCloudVmCluster() *schema.Resource {
56
56
),
57
57
58
58
Schema : map [string ]* schema.Schema {
59
- "backup_subnet_cidr" : {
60
- Type : schema .TypeString ,
61
- Required : true ,
62
- ForceNew : true ,
63
- Description : `CIDR range of the backup subnet.` ,
64
- },
65
- "cidr" : {
66
- Type : schema .TypeString ,
67
- Required : true ,
68
- ForceNew : true ,
69
- Description : `Network settings. CIDR to use for cluster IP allocation.` ,
70
- },
71
59
"cloud_vm_cluster_id" : {
72
60
Type : schema .TypeString ,
73
61
Required : true ,
@@ -91,12 +79,25 @@ projects/{project}/locations/{region}/cloudExadataInfrastuctures/{cloud_extradat
91
79
ForceNew : true ,
92
80
Description : `Resource ID segment making up resource 'name'. See documentation for resource type 'oracledatabase.googleapis.com/DbNode'.` ,
93
81
},
94
- "network " : {
82
+ "backup_odb_subnet " : {
95
83
Type : schema .TypeString ,
96
- Required : true ,
84
+ Optional : true ,
97
85
ForceNew : true ,
98
- Description : `The name of the VPC network.
99
- Format: projects/{project}/global/networks/{network}` ,
86
+ Description : `The name of the backup OdbSubnet associated with the VM Cluster.
87
+ Format:
88
+ projects/{project}/locations/{location}/odbNetworks/{odb_network}/odbSubnets/{odb_subnet}` ,
89
+ },
90
+ "backup_subnet_cidr" : {
91
+ Type : schema .TypeString ,
92
+ Optional : true ,
93
+ ForceNew : true ,
94
+ Description : `CIDR range of the backup subnet.` ,
95
+ },
96
+ "cidr" : {
97
+ Type : schema .TypeString ,
98
+ Optional : true ,
99
+ ForceNew : true ,
100
+ Description : `Network settings. CIDR to use for cluster IP allocation.` ,
100
101
},
101
102
"display_name" : {
102
103
Type : schema .TypeString ,
@@ -113,6 +114,31 @@ Format: projects/{project}/global/networks/{network}`,
113
114
Please refer to the field 'effective_labels' for all of the labels present on the resource.` ,
114
115
Elem : & schema.Schema {Type : schema .TypeString },
115
116
},
117
+ "network" : {
118
+ Type : schema .TypeString ,
119
+ Optional : true ,
120
+ ForceNew : true ,
121
+ Description : `The name of the VPC network.
122
+ Format: projects/{project}/global/networks/{network}` ,
123
+ },
124
+ "odb_network" : {
125
+ Type : schema .TypeString ,
126
+ Optional : true ,
127
+ ForceNew : true ,
128
+ Description : `The name of the OdbNetwork associated with the VM Cluster.
129
+ Format:
130
+ projects/{project}/locations/{location}/odbNetworks/{odb_network}
131
+ It is optional but if specified, this should match the parent ODBNetwork of
132
+ the odb_subnet and backup_odb_subnet.` ,
133
+ },
134
+ "odb_subnet" : {
135
+ Type : schema .TypeString ,
136
+ Optional : true ,
137
+ ForceNew : true ,
138
+ Description : `The name of the OdbSubnet associated with the VM Cluster for
139
+ IP allocation. Format:
140
+ projects/{project}/locations/{location}/odbNetworks/{odb_network}/odbSubnets/{odb_subnet}` ,
141
+ },
116
142
"properties" : {
117
143
Type : schema .TypeList ,
118
144
Optional : true ,
@@ -470,6 +496,24 @@ func resourceOracleDatabaseCloudVmClusterCreate(d *schema.ResourceData, meta int
470
496
} else if v , ok := d .GetOkExists ("network" ); ! tpgresource .IsEmptyValue (reflect .ValueOf (networkProp )) && (ok || ! reflect .DeepEqual (v , networkProp )) {
471
497
obj ["network" ] = networkProp
472
498
}
499
+ odbNetworkProp , err := expandOracleDatabaseCloudVmClusterOdbNetwork (d .Get ("odb_network" ), d , config )
500
+ if err != nil {
501
+ return err
502
+ } else if v , ok := d .GetOkExists ("odb_network" ); ! tpgresource .IsEmptyValue (reflect .ValueOf (odbNetworkProp )) && (ok || ! reflect .DeepEqual (v , odbNetworkProp )) {
503
+ obj ["odbNetwork" ] = odbNetworkProp
504
+ }
505
+ odbSubnetProp , err := expandOracleDatabaseCloudVmClusterOdbSubnet (d .Get ("odb_subnet" ), d , config )
506
+ if err != nil {
507
+ return err
508
+ } else if v , ok := d .GetOkExists ("odb_subnet" ); ! tpgresource .IsEmptyValue (reflect .ValueOf (odbSubnetProp )) && (ok || ! reflect .DeepEqual (v , odbSubnetProp )) {
509
+ obj ["odbSubnet" ] = odbSubnetProp
510
+ }
511
+ backupOdbSubnetProp , err := expandOracleDatabaseCloudVmClusterBackupOdbSubnet (d .Get ("backup_odb_subnet" ), d , config )
512
+ if err != nil {
513
+ return err
514
+ } else if v , ok := d .GetOkExists ("backup_odb_subnet" ); ! tpgresource .IsEmptyValue (reflect .ValueOf (backupOdbSubnetProp )) && (ok || ! reflect .DeepEqual (v , backupOdbSubnetProp )) {
515
+ obj ["backupOdbSubnet" ] = backupOdbSubnetProp
516
+ }
473
517
labelsProp , err := expandOracleDatabaseCloudVmClusterEffectiveLabels (d .Get ("effective_labels" ), d , config )
474
518
if err != nil {
475
519
return err
@@ -611,6 +655,15 @@ func resourceOracleDatabaseCloudVmClusterRead(d *schema.ResourceData, meta inter
611
655
if err := d .Set ("network" , flattenOracleDatabaseCloudVmClusterNetwork (res ["network" ], d , config )); err != nil {
612
656
return fmt .Errorf ("Error reading CloudVmCluster: %s" , err )
613
657
}
658
+ if err := d .Set ("odb_network" , flattenOracleDatabaseCloudVmClusterOdbNetwork (res ["odbNetwork" ], d , config )); err != nil {
659
+ return fmt .Errorf ("Error reading CloudVmCluster: %s" , err )
660
+ }
661
+ if err := d .Set ("odb_subnet" , flattenOracleDatabaseCloudVmClusterOdbSubnet (res ["odbSubnet" ], d , config )); err != nil {
662
+ return fmt .Errorf ("Error reading CloudVmCluster: %s" , err )
663
+ }
664
+ if err := d .Set ("backup_odb_subnet" , flattenOracleDatabaseCloudVmClusterBackupOdbSubnet (res ["backupOdbSubnet" ], d , config )); err != nil {
665
+ return fmt .Errorf ("Error reading CloudVmCluster: %s" , err )
666
+ }
614
667
if err := d .Set ("terraform_labels" , flattenOracleDatabaseCloudVmClusterTerraformLabels (res ["labels" ], d , config )); err != nil {
615
668
return fmt .Errorf ("Error reading CloudVmCluster: %s" , err )
616
669
}
@@ -1089,6 +1142,18 @@ func flattenOracleDatabaseCloudVmClusterNetwork(v interface{}, d *schema.Resourc
1089
1142
return v
1090
1143
}
1091
1144
1145
+ func flattenOracleDatabaseCloudVmClusterOdbNetwork (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
1146
+ return v
1147
+ }
1148
+
1149
+ func flattenOracleDatabaseCloudVmClusterOdbSubnet (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
1150
+ return v
1151
+ }
1152
+
1153
+ func flattenOracleDatabaseCloudVmClusterBackupOdbSubnet (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
1154
+ return v
1155
+ }
1156
+
1092
1157
func flattenOracleDatabaseCloudVmClusterTerraformLabels (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
1093
1158
if v == nil {
1094
1159
return v
@@ -1552,6 +1617,18 @@ func expandOracleDatabaseCloudVmClusterNetwork(v interface{}, d tpgresource.Terr
1552
1617
return v , nil
1553
1618
}
1554
1619
1620
+ func expandOracleDatabaseCloudVmClusterOdbNetwork (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
1621
+ return v , nil
1622
+ }
1623
+
1624
+ func expandOracleDatabaseCloudVmClusterOdbSubnet (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
1625
+ return v , nil
1626
+ }
1627
+
1628
+ func expandOracleDatabaseCloudVmClusterBackupOdbSubnet (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
1629
+ return v , nil
1630
+ }
1631
+
1555
1632
func expandOracleDatabaseCloudVmClusterEffectiveLabels (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (map [string ]string , error ) {
1556
1633
if v == nil {
1557
1634
return map [string ]string {}, nil
0 commit comments