@@ -21,7 +21,6 @@ type DnsCommand struct {
21
21
domainName string
22
22
tfcOrg string
23
23
tfcToken string
24
- dnsValues AlbDnsValues
25
24
testMode bool
26
25
}
27
26
@@ -100,13 +99,12 @@ func newDnsCommand(pFlags PersistentFlags) *DnsCommand {
100
99
}
101
100
102
101
func (d * DnsCommand ) setDnsRecordValues (idpKey string , dnsValues AlbDnsValues , failback bool ) {
103
- primaryOrSecondary := "secondary"
104
102
if failback {
105
- primaryOrSecondary = "primary"
103
+ fmt .Println ("Setting DNS records to primary region..." )
104
+ } else {
105
+ fmt .Println ("Setting DNS records to secondary region..." )
106
106
}
107
107
108
- fmt .Printf ("Setting DNS records to %s...\n " , primaryOrSecondary )
109
-
110
108
dnsRecords := []struct {
111
109
name string
112
110
optionValue string
@@ -187,19 +185,19 @@ func (d *DnsCommand) getAlbDnsValuesFromTfc(workspaceName string) (values AlbDns
187
185
188
186
client , err := tfe .NewClient (config )
189
187
if err != nil {
190
- log .Fatal ( err )
188
+ log .Fatalf ( "Error creating Terraform client: %s" , err )
191
189
}
192
190
193
191
ctx := context .Background ()
194
192
195
193
w , err := client .Workspaces .Read (ctx , d .tfcOrg , workspaceName )
196
194
if err != nil {
197
- log .Fatal ( err )
195
+ log .Fatalf ( "Error reading Terraform workspace %s: %s" , workspaceName , err )
198
196
}
199
197
200
198
outputs , err := client .StateVersionOutputs .ReadCurrent (ctx , w .ID )
201
199
if err != nil {
202
- return
200
+ log . Fatalf ( "Error reading Terraform state outputs on workspace %s: %s" , workspaceName , err )
203
201
}
204
202
205
203
for _ , item := range outputs .Items {
0 commit comments