@@ -43,19 +43,24 @@ var (
4343 "customer_bgp_asn" : Representation {repType : Required , create : `10` , update : `11` },
4444 "public_prefixes" : RepresentationGroup {Required , virtualCircuitPublicPrefixesRepresentation },
4545 }
46+ virtualCircuitPublicRequiredOnlyWithoutDeprecatedRepresentation = representationCopyWithNewProperties (
47+ representationCopyWithRemovedProperties (virtualCircuitPublicRequiredOnlyRepresentation , []string {"customer_bgp_asn" }), map [string ]interface {}{
48+ "customer_asn" : Representation {repType : Required , create : `10` , update : `11` },
49+ })
50+
4651 virtualCircuitRequiredOnlyRepresentation = map [string ]interface {}{
4752 "compartment_id" : Representation {repType : Required , create : `${var.compartment_id}` },
4853 "type" : Representation {repType : Required , create : `${var.virtual_circuit_type}` },
4954 "cross_connect_mappings" : RepresentationGroup {Required , crossConnectMappingsRequiredOnlyRepresentation },
50- "customer_bgp_asn" : Representation {repType : Required , create : `10` , update : `11` },
55+ "customer_asn" : Representation {repType : Required , create : `10` , update : `11` },
5156 "gateway_id" : Representation {repType : Required , create : `${oci_core_drg.test_drg.id}` },
5257 }
5358 virtualCircuitRepresentation = map [string ]interface {}{
5459 "compartment_id" : Representation {repType : Required , create : `${var.compartment_id}` },
5560 "type" : Representation {repType : Required , create : `${var.virtual_circuit_type}` },
5661 "bandwidth_shape_name" : Representation {repType : Optional , create : `10 Gbps` , update : `20 Gbps` },
5762 "cross_connect_mappings" : RepresentationGroup {Required , crossConnectMappingsRequiredOnlyRepresentation },
58- "customer_bgp_asn" : Representation {repType : Required , create : `10` , update : `11` },
63+ "customer_asn" : Representation {repType : Required , create : `10` , update : `11` },
5964 "defined_tags" : Representation {repType : Optional , create : `${map("${oci_identity_tag_namespace.tag-namespace1.name}.${oci_identity_tag.tag1.name}", "value")}` , update : `${map("${oci_identity_tag_namespace.tag-namespace1.name}.${oci_identity_tag.tag1.name}", "updatedValue")}` },
6065 "display_name" : Representation {repType : Optional , create : `displayName` , update : `displayName2` },
6166 "freeform_tags" : Representation {repType : Optional , create : map [string ]string {"Department" : "Finance" }, update : map [string ]string {"Department" : "Accounting" }},
6873 "type" : Representation {repType : Required , create : `${var.virtual_circuit_type}` },
6974 "bandwidth_shape_name" : Representation {repType : Optional , create : "${data.oci_core_virtual_circuit_bandwidth_shapes.test_virtual_circuit_bandwidth_shapes.virtual_circuit_bandwidth_shapes.0.name}" },
7075 "cross_connect_mappings" : RepresentationGroup {Required , virtualCircuitCrossConnectMappingsRepresentation },
71- "customer_bgp_asn" : Representation {repType : Required , create : `10` , update : `11` },
76+ "customer_asn" : Representation {repType : Required , create : `10` , update : `11` },
7277 "display_name" : Representation {repType : Optional , create : `displayName` , update : `displayName2` },
7378 "gateway_id" : Representation {repType : Optional , create : `${oci_core_drg.test_drg.id}` },
7479 "provider_service_id" : Representation {repType : Optional , create : `${data.oci_core_fast_connect_provider_services.test_fast_connect_provider_services.fast_connect_provider_services.0.id}` },
@@ -193,16 +198,42 @@ func TestCoreVirtualCircuitResource_basic(t *testing.T) {
193198 },
194199 ),
195200 },
201+ // verify update from customer_bgp_asn to customer_asn
202+ {
203+ Config : config + compartmentIdVariableStr + VirtualCircuitResourceDependencies + VirtualCircuitPublicPropertyVariables +
204+ generateResourceFromRepresentationMap ("oci_core_virtual_circuit" , "test_virtual_circuit" , Required , Create , virtualCircuitPublicRequiredOnlyWithoutDeprecatedRepresentation ),
205+ Check : resource .ComposeAggregateTestCheckFunc (
206+ resource .TestCheckResourceAttr (resourceName , "compartment_id" , compartmentId ),
207+ resource .TestCheckResourceAttr (resourceName , "cross_connect_mappings.#" , "1" ),
208+ resource .TestCheckResourceAttrSet (resourceName , "cross_connect_mappings.0.cross_connect_or_cross_connect_group_id" ),
209+ resource .TestCheckResourceAttr (resourceName , "cross_connect_mappings.0.vlan" , "200" ),
210+ resource .TestCheckResourceAttr (resourceName , "customer_asn" , "10" ),
211+ resource .TestCheckResourceAttr (resourceName , "public_prefixes.#" , "1" ),
212+ CheckResourceSetContainsElementWithProperties (resourceName , "public_prefixes" , map [string ]string {
213+ "cidr_block" : "11.0.0.0/24" ,
214+ },
215+ []string {}),
216+ resource .TestCheckResourceAttr (resourceName , "type" , "PUBLIC" ),
217+
218+ func (s * terraform.State ) (err error ) {
219+ resId2 , err = fromInstanceState (s , resourceName , "id" )
220+ if resId != resId2 {
221+ return fmt .Errorf ("Resource recreated when it was supposed to be updated." )
222+ }
223+ return err
224+ },
225+ ),
226+ },
196227 // verify update - PUBLIC Virtual Circuit
197228 {
198229 Config : config + compartmentIdVariableStr + VirtualCircuitResourceDependencies + VirtualCircuitPublicPropertyVariables +
199- generateResourceFromRepresentationMap ("oci_core_virtual_circuit" , "test_virtual_circuit" , Required , Update , virtualCircuitPublicRequiredOnlyRepresentation ),
230+ generateResourceFromRepresentationMap ("oci_core_virtual_circuit" , "test_virtual_circuit" , Required , Update , virtualCircuitPublicRequiredOnlyWithoutDeprecatedRepresentation ),
200231 Check : resource .ComposeAggregateTestCheckFunc (
201232 resource .TestCheckResourceAttr (resourceName , "compartment_id" , compartmentId ),
202233 resource .TestCheckResourceAttr (resourceName , "cross_connect_mappings.#" , "1" ),
203234 resource .TestCheckResourceAttrSet (resourceName , "cross_connect_mappings.0.cross_connect_or_cross_connect_group_id" ),
204235 resource .TestCheckResourceAttr (resourceName , "cross_connect_mappings.0.vlan" , "300" ),
205- resource .TestCheckResourceAttr (resourceName , "customer_bgp_asn " , "11" ),
236+ resource .TestCheckResourceAttr (resourceName , "customer_asn " , "11" ),
206237 resource .TestCheckResourceAttr (resourceName , "public_prefixes.#" , "1" ),
207238 CheckResourceSetContainsElementWithProperties (resourceName , "public_prefixes" , map [string ]string {
208239 "cidr_block" : "11.0.1.0/24" ,
@@ -232,7 +263,7 @@ func TestCoreVirtualCircuitResource_basic(t *testing.T) {
232263 resource .TestCheckResourceAttr (resourceName , "cross_connect_mappings.#" , "1" ),
233264 resource .TestCheckResourceAttr (resourceName , "cross_connect_mappings.0.customer_bgp_peering_ip" , "10.0.0.18/31" ),
234265 resource .TestCheckResourceAttr (resourceName , "cross_connect_mappings.0.oracle_bgp_peering_ip" , "10.0.0.19/31" ),
235- resource .TestCheckResourceAttr (resourceName , "customer_bgp_asn " , "10" ),
266+ resource .TestCheckResourceAttr (resourceName , "customer_asn " , "10" ),
236267 resource .TestCheckResourceAttrSet (resourceName , "gateway_id" ),
237268 resource .TestCheckResourceAttrSet (resourceName , "provider_service_id" ),
238269 resource .TestCheckResourceAttr (resourceName , "provider_state" , "INACTIVE" ),
@@ -253,7 +284,7 @@ func TestCoreVirtualCircuitResource_basic(t *testing.T) {
253284 resource .TestCheckResourceAttr (resourceName , "cross_connect_mappings.#" , "1" ),
254285 resource .TestCheckResourceAttr (resourceName , "cross_connect_mappings.0.customer_bgp_peering_ip" , "10.0.0.20/31" ),
255286 resource .TestCheckResourceAttr (resourceName , "cross_connect_mappings.0.oracle_bgp_peering_ip" , "10.0.0.21/31" ),
256- resource .TestCheckResourceAttr (resourceName , "customer_bgp_asn " , "11" ),
287+ resource .TestCheckResourceAttr (resourceName , "customer_asn " , "11" ),
257288 resource .TestCheckResourceAttrSet (resourceName , "gateway_id" ),
258289 resource .TestCheckResourceAttrSet (resourceName , "provider_service_id" ),
259290 resource .TestCheckResourceAttr (resourceName , "provider_state" , "INACTIVE" ),
@@ -283,7 +314,7 @@ func TestCoreVirtualCircuitResource_basic(t *testing.T) {
283314 resource .TestCheckResourceAttr (resourceName , "cross_connect_mappings.0.customer_bgp_peering_ip" , "10.0.0.18/31" ),
284315 resource .TestCheckResourceAttr (resourceName , "cross_connect_mappings.0.oracle_bgp_peering_ip" , "10.0.0.19/31" ),
285316 resource .TestCheckResourceAttr (resourceName , "cross_connect_mappings.0.vlan" , "200" ),
286- resource .TestCheckResourceAttr (resourceName , "customer_bgp_asn " , "10" ),
317+ resource .TestCheckResourceAttr (resourceName , "customer_asn " , "10" ),
287318 resource .TestCheckResourceAttrSet (resourceName , "gateway_id" ),
288319 resource .TestCheckResourceAttr (resourceName , "type" , "PRIVATE" ),
289320
@@ -311,7 +342,7 @@ func TestCoreVirtualCircuitResource_basic(t *testing.T) {
311342 resource .TestCheckResourceAttr (resourceName , "cross_connect_mappings.0.customer_bgp_peering_ip" , "10.0.0.18/31" ),
312343 resource .TestCheckResourceAttr (resourceName , "cross_connect_mappings.0.oracle_bgp_peering_ip" , "10.0.0.19/31" ),
313344 resource .TestCheckResourceAttr (resourceName , "cross_connect_mappings.0.vlan" , "200" ),
314- resource .TestCheckResourceAttr (resourceName , "customer_bgp_asn " , "10" ),
345+ resource .TestCheckResourceAttr (resourceName , "customer_asn " , "10" ),
315346 resource .TestCheckResourceAttr (resourceName , "defined_tags.%" , "1" ),
316347 resource .TestCheckResourceAttr (resourceName , "display_name" , "displayName" ),
317348 resource .TestCheckResourceAttr (resourceName , "freeform_tags.%" , "1" ),
@@ -346,7 +377,7 @@ func TestCoreVirtualCircuitResource_basic(t *testing.T) {
346377 resource .TestCheckResourceAttr (resourceName , "cross_connect_mappings.0.customer_bgp_peering_ip" , "10.0.0.18/31" ),
347378 resource .TestCheckResourceAttr (resourceName , "cross_connect_mappings.0.oracle_bgp_peering_ip" , "10.0.0.19/31" ),
348379 resource .TestCheckResourceAttr (resourceName , "cross_connect_mappings.0.vlan" , "200" ),
349- resource .TestCheckResourceAttr (resourceName , "customer_bgp_asn " , "10" ),
380+ resource .TestCheckResourceAttr (resourceName , "customer_asn " , "10" ),
350381 resource .TestCheckResourceAttr (resourceName , "display_name" , "displayName" ),
351382 resource .TestCheckResourceAttrSet (resourceName , "gateway_id" ),
352383 resource .TestCheckResourceAttr (resourceName , "region" , "us-phoenix-1" ),
@@ -374,7 +405,7 @@ func TestCoreVirtualCircuitResource_basic(t *testing.T) {
374405 resource .TestCheckResourceAttr (resourceName , "cross_connect_mappings.0.customer_bgp_peering_ip" , "10.0.0.20/31" ),
375406 resource .TestCheckResourceAttr (resourceName , "cross_connect_mappings.0.oracle_bgp_peering_ip" , "10.0.0.21/31" ),
376407 resource .TestCheckResourceAttr (resourceName , "cross_connect_mappings.0.vlan" , "300" ),
377- resource .TestCheckResourceAttr (resourceName , "customer_bgp_asn " , "11" ),
408+ resource .TestCheckResourceAttr (resourceName , "customer_asn " , "11" ),
378409 resource .TestCheckResourceAttr (resourceName , "defined_tags.%" , "1" ),
379410 resource .TestCheckResourceAttr (resourceName , "display_name" , "displayName2" ),
380411 resource .TestCheckResourceAttr (resourceName , "freeform_tags.%" , "1" ),
@@ -410,7 +441,7 @@ func TestCoreVirtualCircuitResource_basic(t *testing.T) {
410441 resource .TestCheckResourceAttr (datasourceName , "virtual_circuits.0.cross_connect_mappings.0.customer_bgp_peering_ip" , "10.0.0.20/31" ),
411442 resource .TestCheckResourceAttr (datasourceName , "virtual_circuits.0.cross_connect_mappings.0.oracle_bgp_peering_ip" , "10.0.0.21/31" ),
412443 resource .TestCheckResourceAttr (datasourceName , "virtual_circuits.0.cross_connect_mappings.0.vlan" , "300" ),
413- resource .TestCheckResourceAttr (datasourceName , "virtual_circuits.0.customer_bgp_asn " , "11" ),
444+ resource .TestCheckResourceAttr (datasourceName , "virtual_circuits.0.customer_asn " , "11" ),
414445 resource .TestCheckResourceAttr (datasourceName , "virtual_circuits.0.defined_tags.%" , "1" ),
415446 resource .TestCheckResourceAttr (datasourceName , "virtual_circuits.0.display_name" , "displayName2" ),
416447 resource .TestCheckResourceAttr (datasourceName , "virtual_circuits.0.freeform_tags.%" , "1" ),
@@ -441,7 +472,7 @@ func TestCoreVirtualCircuitResource_basic(t *testing.T) {
441472 resource .TestCheckResourceAttr (singularDatasourceName , "cross_connect_mappings.0.customer_bgp_peering_ip" , "10.0.0.20/31" ),
442473 resource .TestCheckResourceAttr (singularDatasourceName , "cross_connect_mappings.0.oracle_bgp_peering_ip" , "10.0.0.21/31" ),
443474 resource .TestCheckResourceAttr (singularDatasourceName , "cross_connect_mappings.0.vlan" , "300" ),
444- resource .TestCheckResourceAttr (singularDatasourceName , "customer_bgp_asn " , "11" ),
475+ resource .TestCheckResourceAttr (singularDatasourceName , "customer_asn " , "11" ),
445476 resource .TestCheckResourceAttr (singularDatasourceName , "defined_tags.%" , "1" ),
446477 resource .TestCheckResourceAttr (singularDatasourceName , "display_name" , "displayName2" ),
447478 resource .TestCheckResourceAttr (singularDatasourceName , "freeform_tags.%" , "1" ),
0 commit comments