@@ -13,20 +13,20 @@ import (
13
13
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
14
14
)
15
15
16
- func testAccAWSLakeFormationPolicyTag_basic (t * testing.T ) {
17
- resourceName := "aws_lakeformation_policy_tag .test"
16
+ func testAccAWSLakeFormationLFTag_basic (t * testing.T ) {
17
+ resourceName := "aws_lakeformation_lf_tag .test"
18
18
rKey := acctest .RandomWithPrefix ("tf-acc-test" )
19
19
20
20
resource .Test (t , resource.TestCase {
21
21
PreCheck : func () { testAccPreCheck (t ); testAccPartitionHasServicePreCheck (lakeformation .EndpointsID , t ) },
22
22
ErrorCheck : testAccErrorCheck (t , lakeformation .EndpointsID ),
23
23
Providers : testAccProviders ,
24
- CheckDestroy : testAccCheckAWSLakeFormationPolicyTagsDestroy ,
24
+ CheckDestroy : testAccCheckAWSLakeFormationLFTagsDestroy ,
25
25
Steps : []resource.TestStep {
26
26
{
27
- Config : testAccAWSLakeFormationPolicyTagConfig_basic (rKey ),
27
+ Config : testAccAWSLakeFormationLFTagConfig_basic (rKey ),
28
28
Check : resource .ComposeTestCheckFunc (
29
- testAccCheckAWSLakeFormationPolicyTagExists (resourceName ),
29
+ testAccCheckAWSLakeFormationLFTagExists (resourceName ),
30
30
resource .TestCheckResourceAttr (resourceName , "key" , rKey ),
31
31
resource .TestCheckResourceAttr (resourceName , "values.0" , "value" ),
32
32
testAccCheckResourceAttrAccountID (resourceName , "catalog_id" ),
@@ -41,43 +41,43 @@ func testAccAWSLakeFormationPolicyTag_basic(t *testing.T) {
41
41
})
42
42
}
43
43
44
- func testAccAWSLakeFormationPolicyTag_disappears (t * testing.T ) {
45
- resourceName := "aws_lakeformation_policy_tag .test"
44
+ func testAccAWSLakeFormationLFTag_disappears (t * testing.T ) {
45
+ resourceName := "aws_lakeformation_lf_tag .test"
46
46
rKey := acctest .RandomWithPrefix ("tf-acc-test" )
47
47
48
48
resource .ParallelTest (t , resource.TestCase {
49
49
PreCheck : func () { testAccPreCheck (t ); testAccPartitionHasServicePreCheck (lakeformation .EndpointsID , t ) },
50
50
ErrorCheck : testAccErrorCheck (t , lakeformation .EndpointsID ),
51
51
Providers : testAccProviders ,
52
- CheckDestroy : testAccCheckAWSLakeFormationPolicyTagsDestroy ,
52
+ CheckDestroy : testAccCheckAWSLakeFormationLFTagsDestroy ,
53
53
Steps : []resource.TestStep {
54
54
{
55
- Config : testAccAWSLakeFormationPolicyTagConfig_basic (rKey ),
55
+ Config : testAccAWSLakeFormationLFTagConfig_basic (rKey ),
56
56
Check : resource .ComposeTestCheckFunc (
57
- testAccCheckAWSLakeFormationPolicyTagExists (resourceName ),
58
- testAccCheckResourceDisappears (testAccProvider , resourceAwsLakeFormationPolicyTag (), resourceName ),
57
+ testAccCheckAWSLakeFormationLFTagExists (resourceName ),
58
+ testAccCheckResourceDisappears (testAccProvider , resourceAwsLakeFormationLFTag (), resourceName ),
59
59
),
60
60
ExpectNonEmptyPlan : true ,
61
61
},
62
62
},
63
63
})
64
64
}
65
65
66
- func testAccAWSLakeFormationPolicyTag_values (t * testing.T ) {
67
- resourceName := "aws_lakeformation_policy_tag .test"
66
+ func testAccAWSLakeFormationLFTag_values (t * testing.T ) {
67
+ resourceName := "aws_lakeformation_lf_tag .test"
68
68
rKey := acctest .RandomWithPrefix ("tf-acc-test" )
69
69
70
70
resource .Test (t , resource.TestCase {
71
71
PreCheck : func () { testAccPreCheck (t ); testAccPartitionHasServicePreCheck (lakeformation .EndpointsID , t ) },
72
72
ErrorCheck : testAccErrorCheck (t , lakeformation .EndpointsID ),
73
73
Providers : testAccProviders ,
74
- CheckDestroy : testAccCheckAWSLakeFormationPolicyTagsDestroy ,
74
+ CheckDestroy : testAccCheckAWSLakeFormationLFTagsDestroy ,
75
75
Steps : []resource.TestStep {
76
76
{
77
- Config : testAccAWSLakeFormationPolicyTagConfig_values (rKey , []string {"value1" , "value2" }),
77
+ Config : testAccAWSLakeFormationLFTagConfig_values (rKey , []string {"value1" , "value2" }),
78
78
Destroy : false ,
79
79
Check : resource .ComposeTestCheckFunc (
80
- testAccCheckAWSLakeFormationPolicyTagExists (resourceName ),
80
+ testAccCheckAWSLakeFormationLFTagExists (resourceName ),
81
81
resource .TestCheckResourceAttr (resourceName , "key" , rKey ),
82
82
resource .TestCheckResourceAttr (resourceName , "values.0" , "value1" ),
83
83
testAccCheckResourceAttrAccountID (resourceName , "catalog_id" ),
@@ -90,9 +90,9 @@ func testAccAWSLakeFormationPolicyTag_values(t *testing.T) {
90
90
},
91
91
{
92
92
// Test an update that adds, removes and retains a tag value
93
- Config : testAccAWSLakeFormationPolicyTagConfig_values (rKey , []string {"value1" , "value3" }),
93
+ Config : testAccAWSLakeFormationLFTagConfig_values (rKey , []string {"value1" , "value3" }),
94
94
Check : resource .ComposeTestCheckFunc (
95
- testAccCheckAWSLakeFormationPolicyTagExists (resourceName ),
95
+ testAccCheckAWSLakeFormationLFTagExists (resourceName ),
96
96
resource .TestCheckResourceAttr (resourceName , "key" , rKey ),
97
97
resource .TestCheckResourceAttr (resourceName , "values.0" , "value1" ),
98
98
resource .TestCheckResourceAttr (resourceName , "values.1" , "value3" ),
@@ -103,15 +103,15 @@ func testAccAWSLakeFormationPolicyTag_values(t *testing.T) {
103
103
})
104
104
}
105
105
106
- func testAccCheckAWSLakeFormationPolicyTagsDestroy (s * terraform.State ) error {
106
+ func testAccCheckAWSLakeFormationLFTagsDestroy (s * terraform.State ) error {
107
107
conn := testAccProvider .Meta ().(* AWSClient ).lakeformationconn
108
108
109
109
for _ , rs := range s .RootModule ().Resources {
110
- if rs .Type != "aws_lakeformation_policy_tag " {
110
+ if rs .Type != "aws_lakeformation_lf_tag " {
111
111
continue
112
112
}
113
113
114
- catalogID , tagKey , err := readPolicyTagID (rs .Primary .ID )
114
+ catalogID , tagKey , err := readLFTagID (rs .Primary .ID )
115
115
if err != nil {
116
116
return err
117
117
}
@@ -131,13 +131,13 @@ func testAccCheckAWSLakeFormationPolicyTagsDestroy(s *terraform.State) error {
131
131
}
132
132
return err
133
133
}
134
- return fmt .Errorf ("Lake Formation Policy Tag (%s) still exists" , rs .Primary .ID )
134
+ return fmt .Errorf ("Lake Formation LF- Tag (%s) still exists" , rs .Primary .ID )
135
135
}
136
136
137
137
return nil
138
138
}
139
139
140
- func testAccCheckAWSLakeFormationPolicyTagExists (name string ) resource.TestCheckFunc {
140
+ func testAccCheckAWSLakeFormationLFTagExists (name string ) resource.TestCheckFunc {
141
141
return func (s * terraform.State ) error {
142
142
rs , ok := s .RootModule ().Resources [name ]
143
143
if ! ok {
@@ -148,7 +148,7 @@ func testAccCheckAWSLakeFormationPolicyTagExists(name string) resource.TestCheck
148
148
return fmt .Errorf ("No ID is set" )
149
149
}
150
150
151
- catalogID , tagKey , err := readPolicyTagID (rs .Primary .ID )
151
+ catalogID , tagKey , err := readLFTagID (rs .Primary .ID )
152
152
if err != nil {
153
153
return err
154
154
}
@@ -169,15 +169,15 @@ func testAccCheckAWSLakeFormationPolicyTagExists(name string) resource.TestCheck
169
169
}
170
170
}
171
171
172
- func testAccAWSLakeFormationPolicyTagConfig_basic (rKey string ) string {
172
+ func testAccAWSLakeFormationLFTagConfig_basic (rKey string ) string {
173
173
return fmt .Sprintf (`
174
174
data "aws_caller_identity" "current" {}
175
175
176
176
resource "aws_lakeformation_data_lake_settings" "test" {
177
177
admins = [data.aws_caller_identity.current.arn]
178
178
}
179
179
180
- resource "aws_lakeformation_policy_tag " "test" {
180
+ resource "aws_lakeformation_lf_tag " "test" {
181
181
key = %[1]q
182
182
values = ["value"]
183
183
@@ -187,7 +187,7 @@ resource "aws_lakeformation_policy_tag" "test" {
187
187
` , rKey )
188
188
}
189
189
190
- func testAccAWSLakeFormationPolicyTagConfig_values (rKey string , values []string ) string {
190
+ func testAccAWSLakeFormationLFTagConfig_values (rKey string , values []string ) string {
191
191
quotedValues := make ([]string , len (values ))
192
192
for i , v := range values {
193
193
quotedValues [i ] = strconv .Quote (v )
@@ -200,7 +200,7 @@ resource "aws_lakeformation_data_lake_settings" "test" {
200
200
admins = [data.aws_caller_identity.current.arn]
201
201
}
202
202
203
- resource "aws_lakeformation_policy_tag " "test" {
203
+ resource "aws_lakeformation_lf_tag " "test" {
204
204
key = %[1]q
205
205
values = [%s]
206
206
0 commit comments