@@ -15,7 +15,6 @@ import (
1515)
1616
1717var (
18- computeInstanceUpdateSyncOcid = utils .GetEnvSettingWithBlankDefault ("computeInstance_ocid" )
1918 ResourceScheduleUpdateSyncRequiredOnlyResource = ResourceSchedulerScheduleResourceDependencies +
2019 acctest .GenerateResourceFromRepresentationMap ("oci_resource_scheduler_schedule" , "test_schedule" , acctest .Required , acctest .Create , ResourceScheduleUpdateSyncRepresentation )
2120
@@ -39,15 +38,15 @@ var (
3938 // Optionals
4039 "description" : acctest.Representation {RepType : acctest .Optional , Create : `provider description1` , Update : `provider description2` },
4140 "display_name" : acctest.Representation {RepType : acctest .Optional , Create : `provider displayName1` , Update : `provider displayName2` },
42- "time_ends" : acctest.Representation {RepType : acctest .Optional , Create : `2024-11-20T00 :00:00Z` , Update : `2024-11-20T00 :00:00Z` },
43- "time_starts" : acctest.Representation {RepType : acctest .Optional , Create : `2024-11-15T00 :00:00Z` , Update : `2024-11-15T00 :00:00Z` },
41+ "time_ends" : acctest.Representation {RepType : acctest .Optional , Create : `2025-12-31T00 :00:00Z` , Update : `2025-12-25T00 :00:00Z` },
42+ "time_starts" : acctest.Representation {RepType : acctest .Optional , Create : `2025-05-01T00 :00:00Z` , Update : `2025-05-11T00 :00:00Z` },
4443 "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")}` },
4544 "freeform_tags" : acctest.Representation {RepType : acctest .Optional , Create : map [string ]string {"Department" : "Finance" }, Update : map [string ]string {"Department" : "Finance" }},
4645 "lifecycle" : acctest.RepresentationGroup {RepType : acctest .Optional , Group : ignoreChangesDefinedTagsResourceSchedulerRepresentation },
4746 }
4847
4948 ResourceSchedulerScheduleResourcesUpdateSyncRepresentation = map [string ]interface {}{
50- "id" : acctest.Representation {RepType : acctest .Required , Create : computeInstanceUpdateSyncOcid , Update : computeInstanceUpdateSyncOcid },
49+ "id" : acctest.Representation {RepType : acctest .Required , Create : `${var.compute_ocid}` , Update : `${var.compute_ocid}` },
5150 // mimic customer's behavior
5251 "metadata" : acctest.Representation {RepType : acctest .Optional , Create : map [string ]string {"metadata" : "metadata" }, Update : map [string ]string {"metadata" : "metadata" }},
5352 }
@@ -62,6 +61,9 @@ func TestResourceScheduleUpdateSync(t *testing.T) {
6261 compartmentId := utils .GetEnvSettingWithBlankDefault ("compartment_ocid" )
6362 compartmentIdVariableStr := fmt .Sprintf ("variable \" compartment_id\" { default = \" %s\" }\n " , compartmentId )
6463
64+ computeOcid := utils .GetEnvSettingWithBlankDefault ("compute_ocid" )
65+ computeOcidVariableStr := fmt .Sprintf ("variable \" compute_ocid\" { default = \" %s\" }\n " , computeOcid )
66+
6567 resourceName := "oci_resource_scheduler_schedule.test_schedule"
6668 singularDatasourceName := "data.oci_resource_scheduler_schedule.test_schedule"
6769 datasourceName := "data.oci_resource_scheduler_schedules.test_schedules"
@@ -74,7 +76,7 @@ func TestResourceScheduleUpdateSync(t *testing.T) {
7476 acctest .ResourceTest (t , testAccCheckResourceSchedulerScheduleDestroy , []resource.TestStep {
7577 //verify Create with Required - resource ocids
7678 {
77- Config : config + compartmentIdVariableStr + ResourceSchedulerScheduleResourceDependencies +
79+ Config : config + compartmentIdVariableStr + computeOcidVariableStr + ResourceSchedulerScheduleResourceDependencies +
7880 acctest .GenerateResourceFromRepresentationMap ("oci_resource_scheduler_schedule" , "test_schedule" , acctest .Required , acctest .Create , ResourceScheduleUpdateSyncRepresentation ),
7981
8082 Check : acctest .ComposeAggregateTestCheckFuncWrapper (
@@ -100,7 +102,7 @@ func TestResourceScheduleUpdateSync(t *testing.T) {
100102
101103 // verify create with optionals - resourceOCID
102104 {
103- Config : config + compartmentIdVariableStr + ResourceSchedulerScheduleResourceDependencies +
105+ Config : config + compartmentIdVariableStr + computeOcidVariableStr + ResourceSchedulerScheduleResourceDependencies +
104106 acctest .GenerateResourceFromRepresentationMap ("oci_resource_scheduler_schedule" , "test_schedule" , acctest .Optional , acctest .Create , ResourceScheduleUpdateSyncRepresentation ),
105107
106108 Check : acctest .ComposeAggregateTestCheckFuncWrapper (
@@ -111,11 +113,11 @@ func TestResourceScheduleUpdateSync(t *testing.T) {
111113 resource .TestCheckResourceAttr (resourceName , "recurrence_type" , "ICAL" ),
112114 resource .TestCheckResourceAttr (resourceName , "description" , "provider description1" ),
113115 resource .TestCheckResourceAttr (resourceName , "display_name" , "provider displayName1" ),
114- resource .TestCheckResourceAttr (resourceName , "time_ends" , "2024-11-20T00 :00:00Z" ),
115- resource .TestCheckResourceAttr (resourceName , "time_starts" , "2024-11-15T00 :00:00Z" ),
116+ resource .TestCheckResourceAttr (resourceName , "time_ends" , "2025-12-31T00 :00:00Z" ),
117+ resource .TestCheckResourceAttr (resourceName , "time_starts" , "2025-05-01T00 :00:00Z" ),
116118 resource .TestCheckResourceAttr (resourceName , "freeform_tags.%" , "1" ),
117119 resource .TestCheckResourceAttr (resourceName , "resources.#" , "1" ),
118- resource .TestCheckResourceAttr (resourceName , "resources.0.id" , computeInstanceUpdateSyncOcid ),
120+ resource .TestCheckResourceAttr (resourceName , "resources.0.id" , computeOcid ),
119121 resource .TestCheckResourceAttr (resourceName , "resources.0.metadata.%" , "1" ),
120122
121123 func (s * terraform.State ) (err error ) {
@@ -127,7 +129,7 @@ func TestResourceScheduleUpdateSync(t *testing.T) {
127129
128130 //verify updates to updatable parameters
129131 {
130- Config : config + compartmentIdVariableStr + ResourceSchedulerScheduleResourceDependencies +
132+ Config : config + compartmentIdVariableStr + computeOcidVariableStr + ResourceSchedulerScheduleResourceDependencies +
131133 acctest .GenerateResourceFromRepresentationMap ("oci_resource_scheduler_schedule" , "test_schedule" , acctest .Optional , acctest .Update , ResourceScheduleUpdateSyncRepresentation ),
132134 Check : acctest .ComposeAggregateTestCheckFuncWrapper (
133135 resource .TestCheckResourceAttrSet (resourceName , "id" ),
@@ -138,16 +140,15 @@ func TestResourceScheduleUpdateSync(t *testing.T) {
138140 resource .TestCheckResourceAttr (resourceName , "recurrence_type" , "ICAL" ),
139141 resource .TestCheckResourceAttr (resourceName , "description" , "provider description2" ),
140142 resource .TestCheckResourceAttr (resourceName , "display_name" , "provider displayName2" ),
141- resource .TestCheckResourceAttr (resourceName , "time_ends" , "2024-11-20T00 :00:00Z" ),
142- resource .TestCheckResourceAttr (resourceName , "time_starts" , "2024-11-15T00 :00:00Z" ),
143+ resource .TestCheckResourceAttr (resourceName , "time_ends" , "2025-12-25T00 :00:00Z" ),
144+ resource .TestCheckResourceAttr (resourceName , "time_starts" , "2025-05-11T00 :00:00Z" ),
143145 resource .TestCheckResourceAttr (resourceName , "freeform_tags.%" , "1" ),
144146 resource .TestCheckResourceAttr (resourceName , "resources.#" , "1" ),
145- resource .TestCheckResourceAttr (resourceName , "resources.0.id" , computeInstanceOcid ),
147+ resource .TestCheckResourceAttr (resourceName , "resources.0.id" , computeOcid ),
146148 resource .TestCheckResourceAttr (resourceName , "resources.0.metadata.%" , "1" ),
147149
148150 func (s * terraform.State ) (err error ) {
149151 resId2 , err = acctest .FromInstanceState (s , resourceName , "id" )
150- fmt .Printf ("xiaotong printing resId and resId2, %s, %s" , resId , resId2 )
151152 if resId != resId2 {
152153 return fmt .Errorf ("Resource recreated when it was supposed to be updated." )
153154 }
@@ -160,7 +161,7 @@ func TestResourceScheduleUpdateSync(t *testing.T) {
160161 {
161162 Config : config +
162163 acctest .GenerateDataSourceFromRepresentationMap ("oci_resource_scheduler_schedule" , "test_schedule" , acctest .Required , acctest .Create , ResourceScheduleUpdateSyncSingularDataSourceRepresentation ) +
163- compartmentIdVariableStr + ResourceScheduleUpdateSyncRequiredOnlyResource ,
164+ compartmentIdVariableStr + computeOcidVariableStr + ResourceScheduleUpdateSyncRequiredOnlyResource ,
164165
165166 Check : acctest .ComposeAggregateTestCheckFuncWrapper (
166167 resource .TestCheckResourceAttrSet (singularDatasourceName , "id" ),
@@ -177,7 +178,7 @@ func TestResourceScheduleUpdateSync(t *testing.T) {
177178
178179 // verify datasources
179180 {
180- Config : config + compartmentIdVariableStr + ResourceSchedulerScheduleResourceDependencies +
181+ Config : config + compartmentIdVariableStr + computeOcidVariableStr + ResourceSchedulerScheduleResourceDependencies +
181182 acctest .GenerateResourceFromRepresentationMap ("oci_resource_scheduler_schedule" , "test_schedule" , acctest .Required , acctest .Create , ResourceScheduleUpdateSyncRepresentation ) +
182183 acctest .GenerateDataSourceFromRepresentationMap ("oci_resource_scheduler_schedules" , "test_schedules" , acctest .Required , acctest .Create , ResourceScheduleUpdateSyncDataSourceRepresentation ),
183184
0 commit comments