@@ -48,16 +48,22 @@ var (
4848 })
4949
5050 zoneRepresentationPrimaryDefault = map [string ]interface {}{
51- "compartment_id" : acctest.Representation {RepType : acctest .Required , Create : `${var.compartment_id}` },
52- "name" : acctest.Representation {RepType : acctest .Required , Create : `${data.oci_identity_tenancy.test_tenancy.name}.{{.token}}.oci-zone-test` },
53- "zone_type" : acctest.Representation {RepType : acctest .Required , Create : `PRIMARY` },
54- "defined_tags" : acctest.Representation {RepType : acctest .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")}` },
55- "external_masters " : acctest.RepresentationGroup {RepType : acctest .Optional , Group : DnsZoneExternalMastersRepresentation },
56- "freeform_tags" : acctest.Representation {RepType : acctest .Optional , Create : map [string ]string {"freeformTags" : "freeformTags" }, Update : map [string ]string {"freeformTags2" : "freeformTags2" }},
51+ "compartment_id" : acctest.Representation {RepType : acctest .Required , Create : `${var.compartment_id}` },
52+ "name" : acctest.Representation {RepType : acctest .Required , Create : `${data.oci_identity_tenancy.test_tenancy.name}.{{.token}}.oci-zone-test` },
53+ "zone_type" : acctest.Representation {RepType : acctest .Required , Create : `PRIMARY` },
54+ "defined_tags" : acctest.Representation {RepType : acctest .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")}` },
55+ "external_downstreams " : acctest.RepresentationGroup {RepType : acctest .Optional , Group : zoneExternalDownstreamsRepresentation },
56+ "freeform_tags" : acctest.Representation {RepType : acctest .Optional , Create : map [string ]string {"freeformTags" : "freeformTags" }, Update : map [string ]string {"freeformTags2" : "freeformTags2" }},
5757 }
5858
5959 zoneRepresentationDefault = acctest .GetUpdatedRepresentationCopy ("zone_type" , acctest.Representation {RepType : acctest .Required , Create : `SECONDARY` }, zoneRepresentationPrimaryDefault )
6060
61+ zoneExternalDownstreamsRepresentation = map [string ]interface {}{
62+ "address" : acctest.Representation {RepType : acctest .Required , Create : `1.2.3.4` , Update : `2.3.4.5` },
63+ "port" : acctest.Representation {RepType : acctest .Optional , Create : `53` },
64+ "tsig_key_id" : acctest.Representation {RepType : acctest .Optional , Create : `${oci_dns_tsig_key.test_tsig_key.id}` },
65+ }
66+
6167 ZoneResourceDependenciesDefault = acctest .GenerateResourceFromRepresentationMap ("oci_dns_tsig_key" , "test_tsig_key" , acctest .Required , acctest .Create , DnsTsigKeyRepresentation ) +
6268 DefinedTagsDependencies + `
6369data "oci_identity_tenancy" "test_tenancy" {
@@ -103,15 +109,15 @@ func TestDnsZoneResource_default(t *testing.T) {
103109 },
104110 {
105111 Config : tokenFn (config + compartmentIdVariableStr + ZoneResourceDependenciesDefault +
106- acctest .GenerateResourceFromRepresentationMap ("oci_dns_zone" , "test_zone" , acctest .Optional , acctest .Create , zoneRepresentationDefault ), nil ),
112+ acctest .GenerateResourceFromRepresentationMap ("oci_dns_zone" , "test_zone" , acctest .Optional , acctest .Create , zoneRepresentationPrimaryDefault ), nil ),
107113 Check : acctest .ComposeAggregateTestCheckFuncWrapper (
108114 resource .TestCheckResourceAttr (resourceName , "compartment_id" , compartmentId ),
109- resource .TestCheckResourceAttr (resourceName , "external_masters .#" , "1" ),
110- resource .TestCheckResourceAttr (resourceName , "external_masters .0.address" , "77.64.12.1 " ),
111- resource .TestCheckResourceAttr (resourceName , "external_masters .0.port" , "53" ),
112- resource .TestCheckResourceAttrSet (resourceName , "external_masters .0.tsig_key_id" ),
115+ resource .TestCheckResourceAttr (resourceName , "external_downstreams .#" , "1" ),
116+ resource .TestCheckResourceAttr (resourceName , "external_downstreams .0.address" , "1.2.3.4 " ),
117+ resource .TestCheckResourceAttr (resourceName , "external_downstreams .0.port" , "53" ),
118+ resource .TestCheckResourceAttrSet (resourceName , "external_downstreams .0.tsig_key_id" ),
113119 resource .TestMatchResourceAttr (resourceName , "name" , regexp .MustCompile ("\\ .oci-zone-test" )),
114- resource .TestCheckResourceAttr (resourceName , "zone_type" , "SECONDARY " ),
120+ resource .TestCheckResourceAttr (resourceName , "zone_type" , "PRIMARY " ),
115121
116122 func (s * terraform.State ) (err error ) {
117123 resId2 , err = acctest .FromInstanceState (s , resourceName , "id" )
@@ -131,10 +137,13 @@ func TestDnsZoneResource_default(t *testing.T) {
131137 // verify Create with optionals
132138 {
133139 Config : tokenFn (config + compartmentIdVariableStr + ZoneResourceDependenciesDefault +
134- acctest .GenerateResourceFromRepresentationMap ("oci_dns_zone" , "test_zone" , acctest .Optional , acctest .Create ,
135- acctest .RepresentationCopyWithRemovedProperties (zoneRepresentationPrimaryDefault , []string {"external_masters" })), nil ),
140+ acctest .GenerateResourceFromRepresentationMap ("oci_dns_zone" , "test_zone" , acctest .Optional , acctest .Create , zoneRepresentationPrimaryDefault ), nil ),
136141 Check : acctest .ComposeAggregateTestCheckFuncWrapper (
137142 resource .TestCheckResourceAttr (resourceName , "compartment_id" , compartmentId ),
143+ resource .TestCheckResourceAttr (resourceName , "external_downstreams.#" , "1" ),
144+ resource .TestCheckResourceAttr (resourceName , "external_downstreams.0.address" , "1.2.3.4" ),
145+ resource .TestCheckResourceAttr (resourceName , "external_downstreams.0.port" , "53" ),
146+ resource .TestCheckResourceAttrSet (resourceName , "external_downstreams.0.tsig_key_id" ),
138147 resource .TestMatchResourceAttr (resourceName , "name" , regexp .MustCompile ("\\ .oci-zone-test" )),
139148 resource .TestCheckResourceAttr (resourceName , "zone_type" , "PRIMARY" ),
140149 resource .TestCheckResourceAttr (resourceName , "freeform_tags.%" , "1" ),
@@ -163,11 +172,15 @@ func TestDnsZoneResource_default(t *testing.T) {
163172 {
164173 Config : tokenFn (config + compartmentIdVariableStr + compartmentIdUVariableStr + ZoneResourceDependenciesDefault +
165174 acctest .GenerateResourceFromRepresentationMap ("oci_dns_zone" , "test_zone" , acctest .Optional , acctest .Create ,
166- acctest .RepresentationCopyWithNewProperties (acctest . RepresentationCopyWithRemovedProperties ( zoneRepresentationPrimaryDefault , [] string { "external_masters" }) , map [string ]interface {}{
175+ acctest .RepresentationCopyWithNewProperties (zoneRepresentationPrimaryDefault , map [string ]interface {}{
167176 "compartment_id" : acctest.Representation {RepType : acctest .Required , Create : `${var.compartment_id_for_update}` },
168177 })), nil ),
169178 Check : acctest .ComposeAggregateTestCheckFuncWrapper (
170179 resource .TestCheckResourceAttr (resourceName , "compartment_id" , compartmentIdU ),
180+ resource .TestCheckResourceAttr (resourceName , "external_downstreams.#" , "1" ),
181+ resource .TestCheckResourceAttr (resourceName , "external_downstreams.0.address" , "1.2.3.4" ),
182+ resource .TestCheckResourceAttr (resourceName , "external_downstreams.0.port" , "53" ),
183+ resource .TestCheckResourceAttrSet (resourceName , "external_downstreams.0.tsig_key_id" ),
171184 resource .TestMatchResourceAttr (resourceName , "name" , regexp .MustCompile ("\\ .oci-zone-test" )),
172185 resource .TestCheckResourceAttr (resourceName , "zone_type" , "PRIMARY" ),
173186 resource .TestCheckResourceAttr (resourceName , "freeform_tags.%" , "1" ),
@@ -194,10 +207,13 @@ func TestDnsZoneResource_default(t *testing.T) {
194207 // verify updates to updatable parameters
195208 {
196209 Config : tokenFn (config + compartmentIdVariableStr + ZoneResourceDependenciesDefault +
197- acctest .GenerateResourceFromRepresentationMap ("oci_dns_zone" , "test_zone" , acctest .Optional , acctest .Update ,
198- acctest .RepresentationCopyWithRemovedProperties (zoneRepresentationPrimaryDefault , []string {"external_masters" })), nil ),
210+ acctest .GenerateResourceFromRepresentationMap ("oci_dns_zone" , "test_zone" , acctest .Optional , acctest .Update , zoneRepresentationPrimaryDefault ), nil ),
199211 Check : acctest .ComposeAggregateTestCheckFuncWrapper (
200212 resource .TestCheckResourceAttr (resourceName , "compartment_id" , compartmentId ),
213+ resource .TestCheckResourceAttr (resourceName , "external_downstreams.#" , "1" ),
214+ resource .TestCheckResourceAttr (resourceName , "external_downstreams.0.address" , "2.3.4.5" ),
215+ resource .TestCheckResourceAttr (resourceName , "external_downstreams.0.port" , "53" ),
216+ resource .TestCheckResourceAttrSet (resourceName , "external_downstreams.0.tsig_key_id" ),
201217 resource .TestCheckResourceAttr (resourceName , "freeform_tags.%" , "1" ),
202218 resource .TestCheckResourceAttr (resourceName , "zone_type" , "PRIMARY" ),
203219 resource .TestMatchResourceAttr (resourceName , "name" , regexp .MustCompile ("\\ .oci-zone-test" )),
@@ -227,6 +243,10 @@ func TestDnsZoneResource_default(t *testing.T) {
227243 acctest .GenerateResourceFromRepresentationMap ("oci_dns_zone" , "test_zone" , acctest .Required , acctest .Create , zoneRepresentationPrimaryDefault ), nil ),
228244 Check : acctest .ComposeAggregateTestCheckFuncWrapper (
229245 resource .TestCheckResourceAttr (datasourceName , "compartment_id" , compartmentId ),
246+ resource .TestCheckResourceAttr (resourceName , "external_downstreams.#" , "1" ),
247+ resource .TestCheckResourceAttr (resourceName , "external_downstreams.0.address" , "2.3.4.5" ),
248+ resource .TestCheckResourceAttr (resourceName , "external_downstreams.0.port" , "53" ),
249+ resource .TestCheckResourceAttrSet (resourceName , "external_downstreams.0.tsig_key_id" ),
230250 resource .TestCheckResourceAttr (datasourceName , "zones.#" , "1" ),
231251 resource .TestCheckResourceAttr (datasourceName , "zones.0.freeform_tags.%" , "1" ),
232252 resource .TestCheckResourceAttrSet (datasourceName , "zones.0.id" ),
0 commit comments