in helpers/foundation-deployer/stages/apply.go [189:243]
func DeployOrgStage(t testing.TB, s steps.Steps, tfvars GlobalTFVars, outputs BootstrapOutputs, c CommonConf) error {
createACMAPolicy := testutils.GetOrgACMPolicyID(t, tfvars.OrgID) == ""
orgTfvars := OrgTfvars{
DomainsToAllow: tfvars.DomainsToAllow,
EssentialContactsDomains: tfvars.EssentialContactsDomains,
SccNotificationName: tfvars.SccNotificationName,
RemoteStateBucket: outputs.RemoteStateBucket,
EnableHubAndSpoke: tfvars.EnableHubAndSpoke,
CreateACMAPolicy: createACMAPolicy,
CreateUniqueTagKey: tfvars.CreateUniqueTagKey,
CaiMonitoringKmsForceDestroy: tfvars.CaiMonitoringKmsForceDestroy,
AuditLogsTableDeleteContentsOnDestroy: tfvars.AuditLogsTableDeleteContentsOnDestroy,
LogExportStorageForceDestroy: tfvars.LogExportStorageForceDestroy,
LogExportStorageLocation: tfvars.LogExportStorageLocation,
BillingExportDatasetLocation: tfvars.BillingExportDatasetLocation,
}
orgTfvars.GcpGroups = GcpGroups{}
if tfvars.HasOptionalGroupsCreation() {
if (*tfvars.Groups.OptionalGroups.GcpSecurityReviewer) != "" {
orgTfvars.GcpGroups.SecurityReviewer = tfvars.Groups.OptionalGroups.GcpSecurityReviewer
}
if (*tfvars.Groups.OptionalGroups.GcpNetworkViewer) != "" {
orgTfvars.GcpGroups.NetworkViewer = tfvars.Groups.OptionalGroups.GcpNetworkViewer
}
if (*tfvars.Groups.OptionalGroups.GcpSccAdmin) != "" {
orgTfvars.GcpGroups.SccAdmin = tfvars.Groups.OptionalGroups.GcpSccAdmin
}
if (*tfvars.Groups.OptionalGroups.GcpGlobalSecretsAdmin) != "" {
orgTfvars.GcpGroups.GlobalSecretsAdmin = tfvars.Groups.OptionalGroups.GcpGlobalSecretsAdmin
}
if (*tfvars.Groups.OptionalGroups.GcpKmsAdmin) != "" {
orgTfvars.GcpGroups.KmsAdmin = tfvars.Groups.OptionalGroups.GcpKmsAdmin
}
}
err := utils.WriteTfvars(filepath.Join(c.FoundationPath, OrgStep, "envs", "shared", "terraform.tfvars"), orgTfvars)
if err != nil {
return err
}
conf := utils.CloneCSR(t, OrgRepo, filepath.Join(c.CheckoutPath, OrgRepo), outputs.CICDProject, c.Logger)
stageConf := StageConf{
Stage: OrgRepo,
CICDProject: outputs.CICDProject,
DefaultRegion: outputs.DefaultRegion,
Step: OrgStep,
Repo: OrgRepo,
GitConf: conf,
Envs: []string{"shared"},
}
return deployStage(t, stageConf, s, c)
}