Skip to content

Commit aa6a89c

Browse files
committed
minor changes for clarity
1 parent 93270b9 commit aa6a89c

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

cmd/cli/multiregion/dns.go

+11-9
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,9 @@ func (d *DnsCommand) setDnsRecordValues(idpKey string, dnsValues DnsValues) {
107107
}
108108

109109
dnsRecords := []struct {
110-
name string
111-
optionValue string
112-
tfcValue string
110+
name string
111+
valueFlag string
112+
tfcValue string
113113
}{
114114
// "mfa-api" is the TOTP API, also known as serverless-mfa-api
115115
{"mfa-api", "mfa-api-value", dnsValues.mfa},
@@ -129,16 +129,16 @@ func (d *DnsCommand) setDnsRecordValues(idpKey string, dnsValues DnsValues) {
129129
}
130130

131131
for _, record := range dnsRecords {
132-
value := getDnsValue(record.optionValue, record.tfcValue)
132+
value := getDnsValue(record.valueFlag, record.tfcValue)
133133
d.setCloudflareCname(record.name, value)
134134
}
135135
}
136136

137-
func getDnsValue(key, tfcValue string) string {
137+
func getDnsValue(valueFlag, tfcValue string) string {
138138
if tfcValue != "" {
139139
return tfcValue
140140
}
141-
return viper.GetString(key)
141+
return viper.GetString(valueFlag)
142142
}
143143

144144
func (d *DnsCommand) setCloudflareCname(name, value string) {
@@ -201,19 +201,19 @@ func (d *DnsCommand) getDnsValuesFromTfc(pFlags PersistentFlags) (values DnsValu
201201

202202
bot := "idp-support-bot-prod"
203203
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
205205
}
206206
values.bot = d.getLambdaDnsValueFromTfc(ctx, bot)
207207

208208
twosv := "serverless-mfa-api-go-prod"
209209
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
211211
}
212212
values.twosv = d.getLambdaDnsValueFromTfc(ctx, twosv)
213213

214214
mfa := "serverless-mfa-api-prod"
215215
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
217217
}
218218
values.mfa = d.getLambdaDnsValueFromTfc(ctx, mfa)
219219
return
@@ -277,6 +277,8 @@ func (d *DnsCommand) getTfcOutputFromWorkspace(ctx context.Context, workspaceNam
277277
return ""
278278
}
279279

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
280282
func (d *DnsCommand) findTfcWorkspace(ctx context.Context, workspaceName string) (id string, client *tfe.Client, err error) {
281283
config := &tfe.Config{
282284
Token: d.tfcToken,

0 commit comments

Comments
 (0)