@@ -18,7 +18,8 @@ func testAccReportDefinitionDataSource_basic(t *testing.T) {
18
18
resourceName := "aws_cur_report_definition.test"
19
19
datasourceName := "data.aws_cur_report_definition.test"
20
20
reportName := sdkacctest .RandomWithPrefix ("tf_acc_test" )
21
- bucketName := fmt .Sprintf ("tf-test-bucket-%d" , sdkacctest .RandInt ())
21
+ s3BucketName := fmt .Sprintf ("tf-test-bucket-%d" , sdkacctest .RandInt ())
22
+ s3Prefix := "test"
22
23
23
24
resource .Test (t , resource.TestCase {
24
25
PreCheck : func () { acctest .PreCheck (ctx , t ) },
@@ -27,7 +28,7 @@ func testAccReportDefinitionDataSource_basic(t *testing.T) {
27
28
CheckDestroy : testAccCheckReportDefinitionDestroy (ctx ),
28
29
Steps : []resource.TestStep {
29
30
{
30
- Config : testAccReportDefinitionDataSourceConfig_basic (reportName , bucketName ),
31
+ Config : testAccReportDefinitionDataSourceConfig_basic (reportName , s3BucketName , s3Prefix ),
31
32
Check : resource .ComposeTestCheckFunc (
32
33
resource .TestCheckResourceAttrPair (datasourceName , "report_name" , resourceName , "report_name" ),
33
34
resource .TestCheckResourceAttrPair (datasourceName , "time_unit" , resourceName , "time_unit" ),
@@ -48,7 +49,8 @@ func testAccReportDefinitionDataSource_additional(t *testing.T) {
48
49
resourceName := "aws_cur_report_definition.test"
49
50
datasourceName := "data.aws_cur_report_definition.test"
50
51
reportName := sdkacctest .RandomWithPrefix ("tf_acc_test" )
51
- bucketName := fmt .Sprintf ("tf-test-bucket-%d" , sdkacctest .RandInt ())
52
+ s3BucketName := fmt .Sprintf ("tf-test-bucket-%d" , sdkacctest .RandInt ())
53
+ s3Prefix := "test"
52
54
53
55
resource .Test (t , resource.TestCase {
54
56
PreCheck : func () { acctest .PreCheck (ctx , t ) },
@@ -57,7 +59,7 @@ func testAccReportDefinitionDataSource_additional(t *testing.T) {
57
59
CheckDestroy : testAccCheckReportDefinitionDestroy (ctx ),
58
60
Steps : []resource.TestStep {
59
61
{
60
- Config : testAccReportDefinitionDataSourceConfig_additional (reportName , bucketName ),
62
+ Config : testAccReportDefinitionDataSourceConfig_additional (reportName , s3BucketName , s3Prefix ),
61
63
Check : resource .ComposeTestCheckFunc (
62
64
resource .TestCheckResourceAttrPair (datasourceName , "report_name" , resourceName , "report_name" ),
63
65
resource .TestCheckResourceAttrPair (datasourceName , "time_unit" , resourceName , "time_unit" ),
@@ -75,7 +77,7 @@ func testAccReportDefinitionDataSource_additional(t *testing.T) {
75
77
})
76
78
}
77
79
78
- func testAccReportDefinitionDataSourceConfig_basic (reportName string , bucketName string ) string {
80
+ func testAccReportDefinitionDataSourceConfig_basic (reportName , s3BucketName , s3Prefix string ) string {
79
81
return fmt .Sprintf (`
80
82
data "aws_billing_service_account" "test" {}
81
83
@@ -129,18 +131,18 @@ resource "aws_cur_report_definition" "test" {
129
131
compression = "GZIP"
130
132
additional_schema_elements = ["RESOURCES", "SPLIT_COST_ALLOCATION_DATA"]
131
133
s3_bucket = aws_s3_bucket.test.id
132
- s3_prefix = ""
134
+ s3_prefix = %[3]q
133
135
s3_region = aws_s3_bucket.test.region
134
136
additional_artifacts = ["REDSHIFT", "QUICKSIGHT"]
135
137
}
136
138
137
139
data "aws_cur_report_definition" "test" {
138
140
report_name = aws_cur_report_definition.test.report_name
139
141
}
140
- ` , reportName , bucketName )
142
+ ` , reportName , s3BucketName , s3Prefix )
141
143
}
142
144
143
- func testAccReportDefinitionDataSourceConfig_additional (reportName string , bucketName string ) string {
145
+ func testAccReportDefinitionDataSourceConfig_additional (reportName , s3BucketName , s3Prefix string ) string {
144
146
return fmt .Sprintf (`
145
147
data "aws_billing_service_account" "test" {}
146
148
@@ -194,7 +196,7 @@ resource "aws_cur_report_definition" "test" {
194
196
compression = "GZIP"
195
197
additional_schema_elements = ["RESOURCES", "SPLIT_COST_ALLOCATION_DATA"]
196
198
s3_bucket = aws_s3_bucket.test.id
197
- s3_prefix = ""
199
+ s3_prefix = %[3]q
198
200
s3_region = aws_s3_bucket.test.region
199
201
additional_artifacts = ["REDSHIFT", "QUICKSIGHT"]
200
202
refresh_closed_reports = true
@@ -204,5 +206,5 @@ resource "aws_cur_report_definition" "test" {
204
206
data "aws_cur_report_definition" "test" {
205
207
report_name = aws_cur_report_definition.test.report_name
206
208
}
207
- ` , reportName , bucketName )
209
+ ` , reportName , s3BucketName , s3Prefix )
208
210
}
0 commit comments