@@ -7,12 +7,13 @@ import (
7
7
"time"
8
8
9
9
"errors"
10
+
10
11
tfe "github.com/hashicorp/go-tfe"
11
12
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
12
13
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
13
14
)
14
15
15
- func TestAccTFEOrganizationDefaultExecutionMode_remote (t * testing.T ) {
16
+ func TestAccTFEOrganizationDefaultSettings_remote (t * testing.T ) {
16
17
org := & tfe.Organization {}
17
18
rInt := rand .New (rand .NewSource (time .Now ().UnixNano ())).Int ()
18
19
@@ -22,18 +23,18 @@ func TestAccTFEOrganizationDefaultExecutionMode_remote(t *testing.T) {
22
23
CheckDestroy : testAccCheckTFEOrganizationDestroy ,
23
24
Steps : []resource.TestStep {
24
25
{
25
- Config : testAccTFEOrganizationDefaultExecutionMode_remote (rInt ),
26
+ Config : testAccTFEOrganizationDefaultSettings_remote (rInt ),
26
27
Check : resource .ComposeTestCheckFunc (
27
28
testAccCheckTFEOrganizationExists (
28
29
"tfe_organization.foobar" , org ),
29
- testAccCheckTFEOrganizationDefaultExecutionMode (org , "remote" ),
30
+ testAccCheckTFEOrganizationDefaultSettings (org , "remote" ),
30
31
),
31
32
},
32
33
},
33
34
})
34
35
}
35
36
36
- func TestAccTFEOrganizationDefaultExecutionMode_local (t * testing.T ) {
37
+ func TestAccTFEOrganizationDefaultSettings_local (t * testing.T ) {
37
38
org := & tfe.Organization {}
38
39
rInt := rand .New (rand .NewSource (time .Now ().UnixNano ())).Int ()
39
40
@@ -43,18 +44,18 @@ func TestAccTFEOrganizationDefaultExecutionMode_local(t *testing.T) {
43
44
CheckDestroy : testAccCheckTFEOrganizationDestroy ,
44
45
Steps : []resource.TestStep {
45
46
{
46
- Config : testAccTFEOrganizationDefaultExecutionMode_local (rInt ),
47
+ Config : testAccTFEOrganizationDefaultSettings_local (rInt ),
47
48
Check : resource .ComposeTestCheckFunc (
48
49
testAccCheckTFEOrganizationExists (
49
50
"tfe_organization.foobar" , org ),
50
- testAccCheckTFEOrganizationDefaultExecutionMode (org , "local" ),
51
+ testAccCheckTFEOrganizationDefaultSettings (org , "local" ),
51
52
),
52
53
},
53
54
},
54
55
})
55
56
}
56
57
57
- func TestAccTFEOrganizationDefaultExecutionMode_agent (t * testing.T ) {
58
+ func TestAccTFEOrganizationDefaultSettings_agent (t * testing.T ) {
58
59
org := & tfe.Organization {}
59
60
rInt := rand .New (rand .NewSource (time .Now ().UnixNano ())).Int ()
60
61
@@ -64,19 +65,19 @@ func TestAccTFEOrganizationDefaultExecutionMode_agent(t *testing.T) {
64
65
CheckDestroy : testAccCheckTFEOrganizationDestroy ,
65
66
Steps : []resource.TestStep {
66
67
{
67
- Config : testAccTFEOrganizationDefaultExecutionMode_agent (rInt ),
68
+ Config : testAccTFEOrganizationDefaultSettings_agent (rInt ),
68
69
Check : resource .ComposeTestCheckFunc (
69
70
testAccCheckTFEOrganizationExists (
70
71
"tfe_organization.foobar" , org ),
71
- testAccCheckTFEOrganizationDefaultExecutionMode (org , "agent" ),
72
+ testAccCheckTFEOrganizationDefaultSettings (org , "agent" ),
72
73
testAccCheckTFEOrganizationDefaultAgentPoolIDExists (org ),
73
74
),
74
75
},
75
76
},
76
77
})
77
78
}
78
79
79
- func TestAccTFEOrganizationDefaultExecutionMode_update (t * testing.T ) {
80
+ func TestAccTFEOrganizationDefaultSettings_update (t * testing.T ) {
80
81
org := & tfe.Organization {}
81
82
rInt := rand .New (rand .NewSource (time .Now ().UnixNano ())).Int ()
82
83
@@ -86,43 +87,43 @@ func TestAccTFEOrganizationDefaultExecutionMode_update(t *testing.T) {
86
87
CheckDestroy : testAccCheckTFEOrganizationDestroy ,
87
88
Steps : []resource.TestStep {
88
89
{
89
- Config : testAccTFEOrganizationDefaultExecutionMode_remote (rInt ),
90
+ Config : testAccTFEOrganizationDefaultSettings_remote (rInt ),
90
91
Check : resource .ComposeTestCheckFunc (
91
92
testAccCheckTFEOrganizationExists (
92
93
"tfe_organization.foobar" , org ),
93
- testAccCheckTFEOrganizationDefaultExecutionMode (org , "remote" ),
94
+ testAccCheckTFEOrganizationDefaultSettings (org , "remote" ),
94
95
),
95
96
},
96
97
{
97
- Config : testAccTFEOrganizationDefaultExecutionMode_agent (rInt ),
98
+ Config : testAccTFEOrganizationDefaultSettings_agent (rInt ),
98
99
Check : resource .ComposeTestCheckFunc (
99
100
testAccCheckTFEOrganizationExists (
100
101
"tfe_organization.foobar" , org ),
101
- testAccCheckTFEOrganizationDefaultExecutionMode (org , "agent" ),
102
+ testAccCheckTFEOrganizationDefaultSettings (org , "agent" ),
102
103
testAccCheckTFEOrganizationDefaultAgentPoolIDExists (org ),
103
104
),
104
105
},
105
106
{
106
- Config : testAccTFEOrganizationDefaultExecutionMode_local (rInt ),
107
+ Config : testAccTFEOrganizationDefaultSettings_local (rInt ),
107
108
Check : resource .ComposeTestCheckFunc (
108
109
testAccCheckTFEOrganizationExists (
109
110
"tfe_organization.foobar" , org ),
110
- testAccCheckTFEOrganizationDefaultExecutionMode (org , "local" ),
111
+ testAccCheckTFEOrganizationDefaultSettings (org , "local" ),
111
112
),
112
113
},
113
114
{
114
- Config : testAccTFEOrganizationDefaultExecutionMode_remote (rInt ),
115
+ Config : testAccTFEOrganizationDefaultSettings_remote (rInt ),
115
116
Check : resource .ComposeTestCheckFunc (
116
117
testAccCheckTFEOrganizationExists (
117
118
"tfe_organization.foobar" , org ),
118
- testAccCheckTFEOrganizationDefaultExecutionMode (org , "remote" ),
119
+ testAccCheckTFEOrganizationDefaultSettings (org , "remote" ),
119
120
),
120
121
},
121
122
},
122
123
})
123
124
}
124
125
125
- func TestAccTFEOrganizationDefaultExecutionMode_import (t * testing.T ) {
126
+ func TestAccTFEOrganizationDefaultSettings_import (t * testing.T ) {
126
127
rInt := rand .New (rand .NewSource (time .Now ().UnixNano ())).Int ()
127
128
128
129
resource .Test (t , resource.TestCase {
@@ -131,19 +132,19 @@ func TestAccTFEOrganizationDefaultExecutionMode_import(t *testing.T) {
131
132
CheckDestroy : testAccCheckTFEOrganizationDestroy ,
132
133
Steps : []resource.TestStep {
133
134
{
134
- Config : testAccTFEOrganizationDefaultExecutionMode_remote (rInt ),
135
+ Config : testAccTFEOrganizationDefaultSettings_remote (rInt ),
135
136
},
136
137
137
138
{
138
- ResourceName : "tfe_organization_default_execution_mode .foobar" ,
139
+ ResourceName : "tfe_organization_default_settings .foobar" ,
139
140
ImportState : true ,
140
141
ImportStateVerify : true ,
141
142
},
142
143
},
143
144
})
144
145
}
145
146
146
- func testAccCheckTFEOrganizationDefaultExecutionMode (org * tfe.Organization , expectedExecutionMode string ) resource.TestCheckFunc {
147
+ func testAccCheckTFEOrganizationDefaultSettings (org * tfe.Organization , expectedExecutionMode string ) resource.TestCheckFunc {
147
148
return func (s * terraform.State ) error {
148
149
if org .DefaultExecutionMode != expectedExecutionMode {
149
150
return fmt .Errorf ("default Execution Mode did not match, expected: %s, but was: %s" , expectedExecutionMode , org .DefaultExecutionMode )
@@ -163,33 +164,33 @@ func testAccCheckTFEOrganizationDefaultAgentPoolIDExists(org *tfe.Organization)
163
164
}
164
165
}
165
166
166
- func testAccTFEOrganizationDefaultExecutionMode_remote (rInt int ) string {
167
+ func testAccTFEOrganizationDefaultSettings_remote (rInt int ) string {
167
168
return fmt .Sprintf (`
168
169
resource "tfe_organization" "foobar" {
169
170
name = "tst-terraform-%d"
170
171
171
172
}
172
173
173
- resource "tfe_organization_default_execution_mode " "foobar" {
174
+ resource "tfe_organization_default_settings " "foobar" {
174
175
organization = tfe_organization.foobar.name
175
176
default_execution_mode = "remote"
176
177
}` , rInt )
177
178
}
178
179
179
- func testAccTFEOrganizationDefaultExecutionMode_local (rInt int ) string {
180
+ func testAccTFEOrganizationDefaultSettings_local (rInt int ) string {
180
181
return fmt .Sprintf (`
181
182
resource "tfe_organization" "foobar" {
182
183
name = "tst-terraform-%d"
183
184
184
185
}
185
186
186
- resource "tfe_organization_default_execution_mode " "foobar" {
187
+ resource "tfe_organization_default_settings " "foobar" {
187
188
organization = tfe_organization.foobar.name
188
189
default_execution_mode = "local"
189
190
}` , rInt )
190
191
}
191
192
192
- func testAccTFEOrganizationDefaultExecutionMode_agent (rInt int ) string {
193
+ func testAccTFEOrganizationDefaultSettings_agent (rInt int ) string {
193
194
return fmt .Sprintf (`
194
195
resource "tfe_organization" "foobar" {
195
196
name = "tst-terraform-%d"
@@ -201,7 +202,7 @@ resource "tfe_agent_pool" "foobar" {
201
202
organization = tfe_organization.foobar.name
202
203
}
203
204
204
- resource "tfe_organization_default_execution_mode " "foobar" {
205
+ resource "tfe_organization_default_settings " "foobar" {
205
206
organization = tfe_organization.foobar.name
206
207
default_execution_mode = "agent"
207
208
default_agent_pool_id = tfe_agent_pool.foobar.id
0 commit comments