forked from cloudfoundry/bosh-bootloader
-
Notifications
You must be signed in to change notification settings - Fork 2
/
terraform_executor.go
60 lines (57 loc) · 1.58 KB
/
terraform_executor.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
package fakes
type TerraformExecutor struct {
ApplyCall struct {
CallCount int
Receives struct {
Credentials string
EnvID string
ProjectID string
Zone string
Region string
Template string
TFState string
}
Returns struct {
TFState string
Error error
}
}
DestroyCall struct {
CallCount int
Receives struct {
Credentials string
EnvID string
ProjectID string
Zone string
Region string
Template string
TFState string
}
Returns struct {
TFState string
Error error
}
}
}
func (t *TerraformExecutor) Apply(credentials, envID, projectID, zone, region, template, tfState string) (string, error) {
t.ApplyCall.CallCount++
t.ApplyCall.Receives.Credentials = credentials
t.ApplyCall.Receives.EnvID = envID
t.ApplyCall.Receives.ProjectID = projectID
t.ApplyCall.Receives.Zone = zone
t.ApplyCall.Receives.Region = region
t.ApplyCall.Receives.Template = template
t.ApplyCall.Receives.TFState = tfState
return t.ApplyCall.Returns.TFState, t.ApplyCall.Returns.Error
}
func (t *TerraformExecutor) Destroy(credentials, envID, projectID, zone, region, template, tfState string) (string, error) {
t.DestroyCall.CallCount++
t.DestroyCall.Receives.Credentials = credentials
t.DestroyCall.Receives.EnvID = envID
t.DestroyCall.Receives.ProjectID = projectID
t.DestroyCall.Receives.Zone = zone
t.DestroyCall.Receives.Region = region
t.DestroyCall.Receives.Template = template
t.DestroyCall.Receives.TFState = tfState
return t.DestroyCall.Returns.TFState, t.DestroyCall.Returns.Error
}