Skip to content

Commit 0fdce63

Browse files
committed
PR feedback: Replace BranchProtect resource name with branch_protect and use Terraform 1.12 style variable reference
1 parent 749cdca commit 0fdce63

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

gitlab/resource_gitlab_branch_protection_test.go

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ func TestAccGitlabBranchProtection_basic(t *testing.T) {
2626
{
2727
Config: testAccGitlabBranchProtectionConfig(rInt),
2828
Check: resource.ComposeTestCheckFunc(
29-
testAccCheckGitlabBranchProtectionExists("gitlab_branch_protection.BranchProtect", &pb),
30-
testAccCheckGitlabBranchProtectionPersistsInStateCorrectly("gitlab_branch_protection.BranchProtect", &pb),
29+
testAccCheckGitlabBranchProtectionExists("gitlab_branch_protection.branch_protect", &pb),
30+
testAccCheckGitlabBranchProtectionPersistsInStateCorrectly("gitlab_branch_protection.branch_protect", &pb),
3131
testAccCheckGitlabBranchProtectionAttributes(&pb, &testAccGitlabBranchProtectionExpectedAttributes{
3232
Name: fmt.Sprintf("BranchProtect-%d", rInt),
3333
PushAccessLevel: accessLevel[gitlab.DeveloperPermissions],
@@ -39,8 +39,8 @@ func TestAccGitlabBranchProtection_basic(t *testing.T) {
3939
{
4040
Config: testAccGitlabBranchProtectionUpdateConfig(rInt),
4141
Check: resource.ComposeTestCheckFunc(
42-
testAccCheckGitlabBranchProtectionExists("gitlab_branch_protection.BranchProtect", &pb),
43-
testAccCheckGitlabBranchProtectionPersistsInStateCorrectly("gitlab_branch_protection.BranchProtect", &pb),
42+
testAccCheckGitlabBranchProtectionExists("gitlab_branch_protection.branch_protect", &pb),
43+
testAccCheckGitlabBranchProtectionPersistsInStateCorrectly("gitlab_branch_protection.branch_protect", &pb),
4444
testAccCheckGitlabBranchProtectionAttributes(&pb, &testAccGitlabBranchProtectionExpectedAttributes{
4545
Name: fmt.Sprintf("BranchProtect-%d", rInt),
4646
PushAccessLevel: accessLevel[gitlab.MasterPermissions],
@@ -52,8 +52,8 @@ func TestAccGitlabBranchProtection_basic(t *testing.T) {
5252
{
5353
Config: testAccGitlabBranchProtectionConfig(rInt),
5454
Check: resource.ComposeTestCheckFunc(
55-
testAccCheckGitlabBranchProtectionExists("gitlab_branch_protection.BranchProtect", &pb),
56-
testAccCheckGitlabBranchProtectionPersistsInStateCorrectly("gitlab_branch_protection.BranchProtect", &pb),
55+
testAccCheckGitlabBranchProtectionExists("gitlab_branch_protection.branch_protect", &pb),
56+
testAccCheckGitlabBranchProtectionPersistsInStateCorrectly("gitlab_branch_protection.branch_protect", &pb),
5757
testAccCheckGitlabBranchProtectionAttributes(&pb, &testAccGitlabBranchProtectionExpectedAttributes{
5858
Name: fmt.Sprintf("BranchProtect-%d", rInt),
5959
PushAccessLevel: accessLevel[gitlab.DeveloperPermissions],
@@ -66,8 +66,8 @@ func TestAccGitlabBranchProtection_basic(t *testing.T) {
6666
SkipFunc: isRunningInCE,
6767
Config: testAccGitlabBranchProtectionUpdateConfigCodeOwnerTrue(rInt),
6868
Check: resource.ComposeTestCheckFunc(
69-
testAccCheckGitlabBranchProtectionExists("gitlab_branch_protection.BranchProtect", &pb),
70-
testAccCheckGitlabBranchProtectionPersistsInStateCorrectly("gitlab_branch_protection.BranchProtect", &pb),
69+
testAccCheckGitlabBranchProtectionExists("gitlab_branch_protection.branch_protect", &pb),
70+
testAccCheckGitlabBranchProtectionPersistsInStateCorrectly("gitlab_branch_protection.branch_protect", &pb),
7171
testAccCheckGitlabBranchProtectionAttributes(&pb, &testAccGitlabBranchProtectionExpectedAttributes{
7272
Name: fmt.Sprintf("BranchProtect-%d", rInt),
7373
PushAccessLevel: accessLevel[gitlab.DeveloperPermissions],
@@ -82,8 +82,8 @@ func TestAccGitlabBranchProtection_basic(t *testing.T) {
8282
Config: testAccGitlabBranchProtectionUpdateConfigCodeOwnerTrue(rInt),
8383
ExpectError: regexp.MustCompile("feature unavailable: code owner approvals"),
8484
Check: resource.ComposeTestCheckFunc(
85-
testAccCheckGitlabBranchProtectionExists("gitlab_branch_protection.BranchProtect", &pb),
86-
testAccCheckGitlabBranchProtectionPersistsInStateCorrectly("gitlab_branch_protection.BranchProtect", &pb),
85+
testAccCheckGitlabBranchProtectionExists("gitlab_branch_protection.branch_protect", &pb),
86+
testAccCheckGitlabBranchProtectionPersistsInStateCorrectly("gitlab_branch_protection.branch_protect", &pb),
8787
testAccCheckGitlabBranchProtectionAttributes(&pb, &testAccGitlabBranchProtectionExpectedAttributes{
8888
Name: fmt.Sprintf("BranchProtect-%d", rInt),
8989
PushAccessLevel: accessLevel[gitlab.DeveloperPermissions],
@@ -95,8 +95,8 @@ func TestAccGitlabBranchProtection_basic(t *testing.T) {
9595
{
9696
Config: testAccGitlabBranchProtectionConfig(rInt),
9797
Check: resource.ComposeTestCheckFunc(
98-
testAccCheckGitlabBranchProtectionExists("gitlab_branch_protection.BranchProtect", &pb),
99-
testAccCheckGitlabBranchProtectionPersistsInStateCorrectly("gitlab_branch_protection.BranchProtect", &pb),
98+
testAccCheckGitlabBranchProtectionExists("gitlab_branch_protection.branch_protect", &pb),
99+
testAccCheckGitlabBranchProtectionPersistsInStateCorrectly("gitlab_branch_protection.branch_protect", &pb),
100100
testAccCheckGitlabBranchProtectionAttributes(&pb, &testAccGitlabBranchProtectionExpectedAttributes{
101101
Name: fmt.Sprintf("BranchProtect-%d", rInt),
102102
PushAccessLevel: accessLevel[gitlab.DeveloperPermissions],
@@ -122,8 +122,8 @@ func TestAccGitlabBranchProtection_createWithCodeOwnerApproval(t *testing.T) {
122122
SkipFunc: isRunningInCE,
123123
Config: testAccGitlabBranchProtectionUpdateConfigCodeOwnerTrue(rInt),
124124
Check: resource.ComposeTestCheckFunc(
125-
testAccCheckGitlabBranchProtectionExists("gitlab_branch_protection.BranchProtect", &pb),
126-
testAccCheckGitlabBranchProtectionPersistsInStateCorrectly("gitlab_branch_protection.BranchProtect", &pb),
125+
testAccCheckGitlabBranchProtectionExists("gitlab_branch_protection.branch_protect", &pb),
126+
testAccCheckGitlabBranchProtectionPersistsInStateCorrectly("gitlab_branch_protection.branch_protect", &pb),
127127
testAccCheckGitlabBranchProtectionAttributes(&pb, &testAccGitlabBranchProtectionExpectedAttributes{
128128
Name: fmt.Sprintf("BranchProtect-%d", rInt),
129129
PushAccessLevel: accessLevel[gitlab.DeveloperPermissions],
@@ -138,8 +138,8 @@ func TestAccGitlabBranchProtection_createWithCodeOwnerApproval(t *testing.T) {
138138
Config: testAccGitlabBranchProtectionUpdateConfigCodeOwnerTrue(rInt),
139139
ExpectError: regexp.MustCompile("feature unavailable: code owner approvals"),
140140
Check: resource.ComposeTestCheckFunc(
141-
testAccCheckGitlabBranchProtectionExists("gitlab_branch_protection.BranchProtect", &pb),
142-
testAccCheckGitlabBranchProtectionPersistsInStateCorrectly("gitlab_branch_protection.BranchProtect", &pb),
141+
testAccCheckGitlabBranchProtectionExists("gitlab_branch_protection.branch_protect", &pb),
142+
testAccCheckGitlabBranchProtectionPersistsInStateCorrectly("gitlab_branch_protection.branch_protect", &pb),
143143
testAccCheckGitlabBranchProtectionAttributes(&pb, &testAccGitlabBranchProtectionExpectedAttributes{
144144
Name: fmt.Sprintf("BranchProtect-%d", rInt),
145145
PushAccessLevel: accessLevel[gitlab.DeveloperPermissions],
@@ -151,8 +151,8 @@ func TestAccGitlabBranchProtection_createWithCodeOwnerApproval(t *testing.T) {
151151
{
152152
Config: testAccGitlabBranchProtectionConfig(rInt),
153153
Check: resource.ComposeTestCheckFunc(
154-
testAccCheckGitlabBranchProtectionExists("gitlab_branch_protection.BranchProtect", &pb),
155-
testAccCheckGitlabBranchProtectionPersistsInStateCorrectly("gitlab_branch_protection.BranchProtect", &pb),
154+
testAccCheckGitlabBranchProtectionExists("gitlab_branch_protection.branch_protect", &pb),
155+
testAccCheckGitlabBranchProtectionPersistsInStateCorrectly("gitlab_branch_protection.branch_protect", &pb),
156156
testAccCheckGitlabBranchProtectionAttributes(&pb, &testAccGitlabBranchProtectionExpectedAttributes{
157157
Name: fmt.Sprintf("BranchProtect-%d", rInt),
158158
PushAccessLevel: accessLevel[gitlab.DeveloperPermissions],
@@ -278,8 +278,8 @@ resource "gitlab_project" "foo" {
278278
visibility_level = "public"
279279
}
280280
281-
resource "gitlab_branch_protection" "BranchProtect" {
282-
project = "${gitlab_project.foo.id}"
281+
resource "gitlab_branch_protection" "branch_protect" {
282+
project = gitlab_project.foo.id
283283
branch = "BranchProtect-%d"
284284
push_access_level = "developer"
285285
merge_access_level = "developer"
@@ -298,8 +298,8 @@ resource "gitlab_project" "foo" {
298298
visibility_level = "public"
299299
}
300300
301-
resource "gitlab_branch_protection" "BranchProtect" {
302-
project = "${gitlab_project.foo.id}"
301+
resource "gitlab_branch_protection" "branch_protect" {
302+
project = gitlab_project.foo.id
303303
branch = "BranchProtect-%d"
304304
push_access_level = "maintainer"
305305
merge_access_level = "maintainer"
@@ -318,7 +318,7 @@ resource "gitlab_project" "foo" {
318318
visibility_level = "public"
319319
}
320320
321-
resource "gitlab_branch_protection" "BranchProtect" {
321+
resource "gitlab_branch_protection" "branch_protect" {
322322
project = gitlab_project.foo.id
323323
branch = "BranchProtect-%d"
324324
push_access_level = "developer"

0 commit comments

Comments
 (0)