in helpers/foundation-deployer/stages/apply.go [192:255]
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,
BillingDataUsers: tfvars.BillingDataUsers,
AuditDataUsers: tfvars.AuditDataUsers,
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,
}
if tfvars.HasGroupsCreation() {
orgTfvars.BillingDataUsers = (*tfvars.Groups).RequiredGroups.BillingDataUsers
orgTfvars.AuditDataUsers = (*tfvars.Groups).RequiredGroups.AuditDataUsers
orgTfvars.GcpGroups = GcpGroups{}
if *(*tfvars.Groups).OptionalGroups.GcpPlatformViewer != "" {
orgTfvars.GcpGroups.PlatformViewer = (*tfvars.Groups).OptionalGroups.GcpPlatformViewer
}
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.GcpAuditViewer != "" {
orgTfvars.GcpGroups.AuditViewer = (*tfvars.Groups).OptionalGroups.GcpAuditViewer
}
} else {
orgTfvars.GcpGroups = GcpGroups{}
}
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)
}