@@ -107,9 +107,9 @@ func (d *DnsCommand) setDnsRecordValues(idpKey string, dnsValues DnsValues) {
107
107
}
108
108
109
109
dnsRecords := []struct {
110
- name string
111
- optionValue string
112
- tfcValue string
110
+ name string
111
+ valueFlag string
112
+ tfcValue string
113
113
}{
114
114
// "mfa-api" is the TOTP API, also known as serverless-mfa-api
115
115
{"mfa-api" , "mfa-api-value" , dnsValues .mfa },
@@ -129,16 +129,16 @@ func (d *DnsCommand) setDnsRecordValues(idpKey string, dnsValues DnsValues) {
129
129
}
130
130
131
131
for _ , record := range dnsRecords {
132
- value := getDnsValue (record .optionValue , record .tfcValue )
132
+ value := getDnsValue (record .valueFlag , record .tfcValue )
133
133
d .setCloudflareCname (record .name , value )
134
134
}
135
135
}
136
136
137
- func getDnsValue (key , tfcValue string ) string {
137
+ func getDnsValue (valueFlag , tfcValue string ) string {
138
138
if tfcValue != "" {
139
139
return tfcValue
140
140
}
141
- return viper .GetString (key )
141
+ return viper .GetString (valueFlag )
142
142
}
143
143
144
144
func (d * DnsCommand ) setCloudflareCname (name , value string ) {
@@ -201,19 +201,19 @@ func (d *DnsCommand) getDnsValuesFromTfc(pFlags PersistentFlags) (values DnsValu
201
201
202
202
bot := "idp-support-bot-prod"
203
203
if pFlags .env != "prod" {
204
- bot = "idp-support-bot-dev"
204
+ bot = "idp-support-bot-dev" // TODO: consider renaming the workspace name so this can be simplified
205
205
}
206
206
values .bot = d .getLambdaDnsValueFromTfc (ctx , bot )
207
207
208
208
twosv := "serverless-mfa-api-go-prod"
209
209
if pFlags .env != "prod" {
210
- twosv = "serverless-mfa-api-go-dev"
210
+ twosv = "serverless-mfa-api-go-dev" // TODO: consider renaming the workspace name so this can be simplified
211
211
}
212
212
values .twosv = d .getLambdaDnsValueFromTfc (ctx , twosv )
213
213
214
214
mfa := "serverless-mfa-api-prod"
215
215
if pFlags .env != "prod" {
216
- mfa = "serverless-mfa-api-dev"
216
+ mfa = "serverless-mfa-api-dev" // TODO: consider renaming the workspace name so this can be simplified
217
217
}
218
218
values .mfa = d .getLambdaDnsValueFromTfc (ctx , mfa )
219
219
return
@@ -277,6 +277,8 @@ func (d *DnsCommand) getTfcOutputFromWorkspace(ctx context.Context, workspaceNam
277
277
return ""
278
278
}
279
279
280
+ // findTfcWorkspace looks for a workspace by name in two different Terraform Cloud accounts and returns
281
+ // the workspace ID and an API client for the account where the workspace was found
280
282
func (d * DnsCommand ) findTfcWorkspace (ctx context.Context , workspaceName string ) (id string , client * tfe.Client , err error ) {
281
283
config := & tfe.Config {
282
284
Token : d .tfcToken ,
0 commit comments