@@ -36,7 +36,7 @@ func TestAccBackupRSCloudBackupSchedule_basic(t *testing.T) {
36
36
}),
37
37
Check : resource .ComposeAggregateTestCheckFunc (
38
38
checkExists (resourceName ),
39
- resource .TestCheckResourceAttr (resourceName , "cluster_name" , clusterInfo .ClusterName ),
39
+ resource .TestCheckResourceAttr (resourceName , "cluster_name" , clusterInfo .Name ),
40
40
resource .TestCheckResourceAttr (resourceName , "reference_hour_of_day" , "3" ),
41
41
resource .TestCheckResourceAttr (resourceName , "reference_minute_of_hour" , "45" ),
42
42
resource .TestCheckResourceAttr (resourceName , "restore_window_days" , "4" ),
@@ -45,7 +45,7 @@ func TestAccBackupRSCloudBackupSchedule_basic(t *testing.T) {
45
45
resource .TestCheckResourceAttr (resourceName , "policy_item_weekly.#" , "0" ),
46
46
resource .TestCheckResourceAttr (resourceName , "policy_item_monthly.#" , "0" ),
47
47
resource .TestCheckResourceAttr (resourceName , "policy_item_yearly.#" , "0" ),
48
- resource .TestCheckResourceAttr (dataSourceName , "cluster_name" , clusterInfo .ClusterName ),
48
+ resource .TestCheckResourceAttr (dataSourceName , "cluster_name" , clusterInfo .Name ),
49
49
resource .TestCheckResourceAttrSet (dataSourceName , "reference_hour_of_day" ),
50
50
resource .TestCheckResourceAttrSet (dataSourceName , "reference_minute_of_hour" ),
51
51
resource .TestCheckResourceAttrSet (dataSourceName , "restore_window_days" ),
@@ -64,7 +64,7 @@ func TestAccBackupRSCloudBackupSchedule_basic(t *testing.T) {
64
64
}, true ),
65
65
Check : resource .ComposeAggregateTestCheckFunc (
66
66
checkExists (resourceName ),
67
- resource .TestCheckResourceAttr (resourceName , "cluster_name" , clusterInfo .ClusterName ),
67
+ resource .TestCheckResourceAttr (resourceName , "cluster_name" , clusterInfo .Name ),
68
68
resource .TestCheckResourceAttr (resourceName , "reference_hour_of_day" , "0" ),
69
69
resource .TestCheckResourceAttr (resourceName , "reference_minute_of_hour" , "0" ),
70
70
resource .TestCheckResourceAttr (resourceName , "restore_window_days" , "7" ),
@@ -93,7 +93,7 @@ func TestAccBackupRSCloudBackupSchedule_basic(t *testing.T) {
93
93
resource .TestCheckResourceAttr (resourceName , "policy_item_yearly.0.frequency_interval" , "1" ),
94
94
resource .TestCheckResourceAttr (resourceName , "policy_item_yearly.0.retention_unit" , "years" ),
95
95
resource .TestCheckResourceAttr (resourceName , "policy_item_yearly.0.retention_value" , "1" ),
96
- resource .TestCheckResourceAttr (dataSourceName , "cluster_name" , clusterInfo .ClusterName ),
96
+ resource .TestCheckResourceAttr (dataSourceName , "cluster_name" , clusterInfo .Name ),
97
97
resource .TestCheckResourceAttrSet (dataSourceName , "reference_hour_of_day" ),
98
98
resource .TestCheckResourceAttrSet (dataSourceName , "reference_minute_of_hour" ),
99
99
resource .TestCheckResourceAttrSet (dataSourceName , "restore_window_days" ),
@@ -107,7 +107,7 @@ func TestAccBackupRSCloudBackupSchedule_basic(t *testing.T) {
107
107
}),
108
108
Check : resource .ComposeAggregateTestCheckFunc (
109
109
checkExists (resourceName ),
110
- resource .TestCheckResourceAttr (resourceName , "cluster_name" , clusterInfo .ClusterName ),
110
+ resource .TestCheckResourceAttr (resourceName , "cluster_name" , clusterInfo .Name ),
111
111
resource .TestCheckResourceAttr (resourceName , "auto_export_enabled" , "false" ),
112
112
resource .TestCheckResourceAttr (resourceName , "reference_hour_of_day" , "0" ),
113
113
resource .TestCheckResourceAttr (resourceName , "reference_minute_of_hour" , "0" ),
@@ -167,7 +167,7 @@ func TestAccBackupRSCloudBackupSchedule_export(t *testing.T) {
167
167
Config : configExportPolicies (& clusterInfo , policyName , roleName , bucketName ),
168
168
Check : resource .ComposeAggregateTestCheckFunc (
169
169
checkExists (resourceName ),
170
- resource .TestCheckResourceAttr (resourceName , "cluster_name" , clusterInfo .ClusterName ),
170
+ resource .TestCheckResourceAttr (resourceName , "cluster_name" , clusterInfo .Name ),
171
171
resource .TestCheckResourceAttr (resourceName , "auto_export_enabled" , "true" ),
172
172
resource .TestCheckResourceAttr (resourceName , "reference_hour_of_day" , "20" ),
173
173
resource .TestCheckResourceAttr (resourceName , "reference_minute_of_hour" , "5" ),
@@ -199,7 +199,7 @@ func TestAccBackupRSCloudBackupSchedule_onePolicy(t *testing.T) {
199
199
}),
200
200
Check : resource .ComposeAggregateTestCheckFunc (
201
201
checkExists (resourceName ),
202
- resource .TestCheckResourceAttr (resourceName , "cluster_name" , clusterInfo .ClusterName ),
202
+ resource .TestCheckResourceAttr (resourceName , "cluster_name" , clusterInfo .Name ),
203
203
resource .TestCheckResourceAttr (resourceName , "reference_hour_of_day" , "3" ),
204
204
resource .TestCheckResourceAttr (resourceName , "reference_minute_of_hour" , "45" ),
205
205
resource .TestCheckResourceAttr (resourceName , "restore_window_days" , "4" ),
@@ -233,7 +233,7 @@ func TestAccBackupRSCloudBackupSchedule_onePolicy(t *testing.T) {
233
233
}),
234
234
Check : resource .ComposeAggregateTestCheckFunc (
235
235
checkExists (resourceName ),
236
- resource .TestCheckResourceAttr (resourceName , "cluster_name" , clusterInfo .ClusterName ),
236
+ resource .TestCheckResourceAttr (resourceName , "cluster_name" , clusterInfo .Name ),
237
237
resource .TestCheckResourceAttr (resourceName , "reference_hour_of_day" , "0" ),
238
238
resource .TestCheckResourceAttr (resourceName , "reference_minute_of_hour" , "0" ),
239
239
resource .TestCheckResourceAttr (resourceName , "restore_window_days" , "7" ),
@@ -259,9 +259,9 @@ func TestAccBackupRSCloudBackupSchedule_copySettings(t *testing.T) {
259
259
},
260
260
PitEnabled : true , // you cannot copy oplogs when pit is not enabled
261
261
})
262
- clusterName = clusterInfo .ClusterName
263
- terraformStr = clusterInfo .ClusterTerraformStr
264
- clusterResourceName = clusterInfo .ClusterResourceName
262
+ clusterName = clusterInfo .Name
263
+ terraformStr = clusterInfo .TerraformStr
264
+ clusterResourceName = clusterInfo .ResourceName
265
265
projectID = clusterInfo .ProjectID
266
266
checkMap = map [string ]string {
267
267
"cluster_name" : clusterName ,
@@ -345,7 +345,7 @@ func TestAccBackupRSCloudBackupScheduleImport_basic(t *testing.T) {
345
345
}),
346
346
Check : resource .ComposeAggregateTestCheckFunc (
347
347
checkExists (resourceName ),
348
- resource .TestCheckResourceAttr (resourceName , "cluster_name" , clusterInfo .ClusterName ),
348
+ resource .TestCheckResourceAttr (resourceName , "cluster_name" , clusterInfo .Name ),
349
349
resource .TestCheckResourceAttr (resourceName , "reference_hour_of_day" , "3" ),
350
350
resource .TestCheckResourceAttr (resourceName , "reference_minute_of_hour" , "45" ),
351
351
resource .TestCheckResourceAttr (resourceName , "restore_window_days" , "4" ),
@@ -400,7 +400,7 @@ func TestAccBackupRSCloudBackupSchedule_azure(t *testing.T) {
400
400
}),
401
401
Check : resource .ComposeAggregateTestCheckFunc (
402
402
checkExists (resourceName ),
403
- resource .TestCheckResourceAttr (resourceName , "cluster_name" , clusterInfo .ClusterName ),
403
+ resource .TestCheckResourceAttr (resourceName , "cluster_name" , clusterInfo .Name ),
404
404
resource .TestCheckResourceAttr (resourceName , "policy_item_hourly.0.frequency_interval" , "1" ),
405
405
resource .TestCheckResourceAttr (resourceName , "policy_item_hourly.0.retention_unit" , "days" ),
406
406
resource .TestCheckResourceAttr (resourceName , "policy_item_hourly.0.retention_value" , "1" )),
@@ -413,7 +413,7 @@ func TestAccBackupRSCloudBackupSchedule_azure(t *testing.T) {
413
413
}),
414
414
Check : resource .ComposeAggregateTestCheckFunc (
415
415
checkExists (resourceName ),
416
- resource .TestCheckResourceAttr (resourceName , "cluster_name" , clusterInfo .ClusterName ),
416
+ resource .TestCheckResourceAttr (resourceName , "cluster_name" , clusterInfo .Name ),
417
417
resource .TestCheckResourceAttr (resourceName , "policy_item_hourly.0.frequency_interval" , "2" ),
418
418
resource .TestCheckResourceAttr (resourceName , "policy_item_hourly.0.retention_unit" , "days" ),
419
419
resource .TestCheckResourceAttr (resourceName , "policy_item_hourly.0.retention_value" , "3" ),
@@ -473,10 +473,10 @@ func checkDestroy(s *terraform.State) error {
473
473
}
474
474
475
475
func configNoPolicies (info * acc.ClusterInfo , p * admin.DiskBackupSnapshotSchedule ) string {
476
- return info .ClusterTerraformStr + fmt .Sprintf (`
476
+ return info .TerraformStr + fmt .Sprintf (`
477
477
resource "mongodbatlas_cloud_backup_schedule" "schedule_test" {
478
478
cluster_name = %[1]s
479
- project_id = %[2]s
479
+ project_id = %[2]q
480
480
481
481
reference_hour_of_day = %[3]d
482
482
reference_minute_of_hour = %[4]d
@@ -485,16 +485,16 @@ func configNoPolicies(info *acc.ClusterInfo, p *admin.DiskBackupSnapshotSchedule
485
485
486
486
data "mongodbatlas_cloud_backup_schedule" "schedule_test" {
487
487
cluster_name = %[1]s
488
- project_id = %[2]s
488
+ project_id = %[2]q
489
489
}
490
- ` , info .ClusterNameStr , info .ProjectIDStr , p .GetReferenceHourOfDay (), p .GetReferenceMinuteOfHour (), p .GetRestoreWindowDays ())
490
+ ` , info .TerraformNameRef , info .ProjectID , p .GetReferenceHourOfDay (), p .GetReferenceMinuteOfHour (), p .GetRestoreWindowDays ())
491
491
}
492
492
493
493
func configDefault (info * acc.ClusterInfo , p * admin.DiskBackupSnapshotSchedule ) string {
494
- return info .ClusterTerraformStr + fmt .Sprintf (`
494
+ return info .TerraformStr + fmt .Sprintf (`
495
495
resource "mongodbatlas_cloud_backup_schedule" "schedule_test" {
496
496
cluster_name = %[1]s
497
- project_id = %[2]s
497
+ project_id = %[2]q
498
498
499
499
reference_hour_of_day = %[3]d
500
500
reference_minute_of_hour = %[4]d
@@ -529,9 +529,9 @@ func configDefault(info *acc.ClusterInfo, p *admin.DiskBackupSnapshotSchedule) s
529
529
530
530
data "mongodbatlas_cloud_backup_schedule" "schedule_test" {
531
531
cluster_name = %[1]s
532
- project_id = %[2]s
532
+ project_id = %[2]q
533
533
}
534
- ` , info .ClusterNameStr , info .ProjectIDStr , p .GetReferenceHourOfDay (), p .GetReferenceMinuteOfHour (), p .GetRestoreWindowDays ())
534
+ ` , info .TerraformNameRef , info .ProjectID , p .GetReferenceHourOfDay (), p .GetReferenceMinuteOfHour (), p .GetRestoreWindowDays ())
535
535
}
536
536
537
537
func configCopySettings (terraformStr , projectID , clusterResourceName string , emptyCopySettings bool , p * admin.DiskBackupSnapshotSchedule ) string {
@@ -592,10 +592,10 @@ func configCopySettings(terraformStr, projectID, clusterResourceName string, emp
592
592
}
593
593
594
594
func configOnePolicy (info * acc.ClusterInfo , p * admin.DiskBackupSnapshotSchedule ) string {
595
- return info .ClusterTerraformStr + fmt .Sprintf (`
595
+ return info .TerraformStr + fmt .Sprintf (`
596
596
resource "mongodbatlas_cloud_backup_schedule" "schedule_test" {
597
597
cluster_name = %[1]s
598
- project_id = %[2]s
598
+ project_id = %[2]q
599
599
600
600
reference_hour_of_day = %[3]d
601
601
reference_minute_of_hour = %[4]d
@@ -607,7 +607,7 @@ func configOnePolicy(info *acc.ClusterInfo, p *admin.DiskBackupSnapshotSchedule)
607
607
retention_value = 1
608
608
}
609
609
}
610
- ` , info .ClusterNameStr , info .ProjectIDStr , p .GetReferenceHourOfDay (), p .GetReferenceMinuteOfHour (), p .GetRestoreWindowDays ())
610
+ ` , info .TerraformNameRef , info .ProjectID , p .GetReferenceHourOfDay (), p .GetReferenceMinuteOfHour (), p .GetRestoreWindowDays ())
611
611
}
612
612
613
613
func configNewPolicies (info * acc.ClusterInfo , p * admin.DiskBackupSnapshotSchedule , useYearly bool ) string {
@@ -622,10 +622,10 @@ func configNewPolicies(info *acc.ClusterInfo, p *admin.DiskBackupSnapshotSchedul
622
622
`
623
623
}
624
624
625
- return info .ClusterTerraformStr + fmt .Sprintf (`
625
+ return info .TerraformStr + fmt .Sprintf (`
626
626
resource "mongodbatlas_cloud_backup_schedule" "schedule_test" {
627
627
cluster_name = %[1]s
628
- project_id = %[2]s
628
+ project_id = %[2]q
629
629
630
630
reference_hour_of_day = %[3]d
631
631
reference_minute_of_hour = %[4]d
@@ -656,16 +656,16 @@ func configNewPolicies(info *acc.ClusterInfo, p *admin.DiskBackupSnapshotSchedul
656
656
657
657
data "mongodbatlas_cloud_backup_schedule" "schedule_test" {
658
658
cluster_name = %[1]s
659
- project_id = %[2]s
659
+ project_id = %[2]q
660
660
}
661
- ` , info .ClusterNameStr , info .ProjectIDStr , p .GetReferenceHourOfDay (), p .GetReferenceMinuteOfHour (), p .GetRestoreWindowDays (), strYearly )
661
+ ` , info .TerraformNameRef , info .ProjectID , p .GetReferenceHourOfDay (), p .GetReferenceMinuteOfHour (), p .GetRestoreWindowDays (), strYearly )
662
662
}
663
663
664
664
func configAzure (info * acc.ClusterInfo , policy * admin.DiskBackupApiPolicyItem ) string {
665
- return info .ClusterTerraformStr + fmt .Sprintf (`
665
+ return info .TerraformStr + fmt .Sprintf (`
666
666
resource "mongodbatlas_cloud_backup_schedule" "schedule_test" {
667
667
cluster_name = %[1]s
668
- project_id = %[2]s
668
+ project_id = %[2]q
669
669
670
670
policy_item_hourly {
671
671
frequency_interval = %[3]d
@@ -676,16 +676,16 @@ func configAzure(info *acc.ClusterInfo, policy *admin.DiskBackupApiPolicyItem) s
676
676
677
677
data "mongodbatlas_cloud_backup_schedule" "schedule_test" {
678
678
cluster_name = %[1]s
679
- project_id = %[2]s
679
+ project_id = %[2]q
680
680
}
681
- ` , info .ClusterNameStr , info .ProjectIDStr , policy .GetFrequencyInterval (), policy .GetRetentionUnit (), policy .GetRetentionValue ())
681
+ ` , info .TerraformNameRef , info .ProjectID , policy .GetFrequencyInterval (), policy .GetRetentionUnit (), policy .GetRetentionValue ())
682
682
}
683
683
684
684
func configAdvancedPolicies (info * acc.ClusterInfo , p * admin.DiskBackupSnapshotSchedule ) string {
685
- return info .ClusterTerraformStr + fmt .Sprintf (`
685
+ return info .TerraformStr + fmt .Sprintf (`
686
686
resource "mongodbatlas_cloud_backup_schedule" "schedule_test" {
687
687
cluster_name = %[1]s
688
- project_id = %[2]s
688
+ project_id = %[2]q
689
689
690
690
auto_export_enabled = false
691
691
reference_hour_of_day = %[3]d
@@ -728,14 +728,14 @@ func configAdvancedPolicies(info *acc.ClusterInfo, p *admin.DiskBackupSnapshotSc
728
728
retention_value = 1
729
729
}
730
730
}
731
- ` , info .ClusterNameStr , info .ProjectIDStr , p .GetReferenceHourOfDay (), p .GetReferenceMinuteOfHour (), p .GetRestoreWindowDays ())
731
+ ` , info .TerraformNameRef , info .ProjectID , p .GetReferenceHourOfDay (), p .GetReferenceMinuteOfHour (), p .GetRestoreWindowDays ())
732
732
}
733
733
734
734
func configExportPolicies (info * acc.ClusterInfo , policyName , roleName , bucketName string ) string {
735
- return info .ClusterTerraformStr + fmt .Sprintf (`
735
+ return info .TerraformStr + fmt .Sprintf (`
736
736
resource "mongodbatlas_cloud_backup_schedule" "schedule_test" {
737
737
cluster_name = %[1]s
738
- project_id = %[2]s
738
+ project_id = %[2]q
739
739
auto_export_enabled = true
740
740
reference_hour_of_day = 20
741
741
reference_minute_of_hour = "05"
@@ -775,20 +775,20 @@ func configExportPolicies(info *acc.ClusterInfo, policyName, roleName, bucketNam
775
775
}
776
776
777
777
resource "mongodbatlas_cloud_provider_access_setup" "setup_only" {
778
- project_id = %[2]s
778
+ project_id = %[2]q
779
779
provider_name = "AWS"
780
780
}
781
781
782
782
resource "mongodbatlas_cloud_provider_access_authorization" "auth_role" {
783
- project_id = %[2]s
783
+ project_id = %[2]q
784
784
role_id = mongodbatlas_cloud_provider_access_setup.setup_only.role_id
785
785
aws {
786
786
iam_assumed_role_arn = aws_iam_role.test_role.arn
787
787
}
788
788
}
789
789
790
790
resource "mongodbatlas_cloud_backup_snapshot_export_bucket" "test" {
791
- project_id = %[2]s
791
+ project_id = %[2]q
792
792
iam_role_id = mongodbatlas_cloud_provider_access_authorization.auth_role.role_id
793
793
bucket_name = aws_s3_bucket.backup.bucket
794
794
cloud_provider = "AWS"
@@ -837,7 +837,7 @@ func configExportPolicies(info *acc.ClusterInfo, policyName, roleName, bucketNam
837
837
}
838
838
EOF
839
839
}
840
- ` , info .ClusterNameStr , info .ProjectIDStr , policyName , roleName , bucketName )
840
+ ` , info .TerraformNameRef , info .ProjectID , policyName , roleName , bucketName )
841
841
}
842
842
843
843
func importStateIDFunc (resourceName string ) resource.ImportStateIdFunc {
0 commit comments