stages

package
v0.0.0-...-5e11853 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PoliciesRepo     = "gcp-policies"
	BootstrapRepo    = "gcp-bootstrap"
	OrgRepo          = "gcp-org"
	EnvironmentsRepo = "gcp-environments"
	NetworksRepo     = "gcp-networks"
	ProjectsRepo     = "gcp-projects"
	AppInfraRepo     = "bu1-example-app"
	BootstrapStep    = "0-bootstrap"
	OrgStep          = "1-org"
	EnvironmentsStep = "2-environments"
	HubAndSpokeStep  = "3-networks-hub-and-spoke"
	DualSvpcStep     = "3-networks-dual-svpc"
	ProjectsStep     = "4-projects"
	AppInfraStep     = "5-app-infra"
)
View Source
const (
	MaxBuildRetries = 40
)

Variables

This section is empty.

Functions

func DeployBootstrapStage

func DeployBootstrapStage(t testing.TB, s steps.Steps, tfvars GlobalTFVars, c CommonConf) error

func DeployEnvStage

func DeployEnvStage(t testing.TB, s steps.Steps, tfvars GlobalTFVars, outputs BootstrapOutputs, c CommonConf) error

func DeployExampleAppStage

func DeployExampleAppStage(t testing.TB, s steps.Steps, tfvars GlobalTFVars, outputs InfraPipelineOutputs, c CommonConf) error

func DeployNetworksStage

func DeployNetworksStage(t testing.TB, s steps.Steps, tfvars GlobalTFVars, outputs BootstrapOutputs, c CommonConf) error

func DeployOrgStage

func DeployOrgStage(t testing.TB, s steps.Steps, tfvars GlobalTFVars, outputs BootstrapOutputs, c CommonConf) error

func DeployProjectsStage

func DeployProjectsStage(t testing.TB, s steps.Steps, tfvars GlobalTFVars, outputs BootstrapOutputs, c CommonConf) error

func DestroyBootstrapStage

func DestroyBootstrapStage(t testing.TB, s steps.Steps, c CommonConf) error

func DestroyEnvStage

func DestroyEnvStage(t testing.TB, s steps.Steps, outputs BootstrapOutputs, c CommonConf) error

func DestroyExampleAppStage

func DestroyExampleAppStage(t testing.TB, s steps.Steps, outputs InfraPipelineOutputs, c CommonConf) error

func DestroyNetworksStage

func DestroyNetworksStage(t testing.TB, s steps.Steps, outputs BootstrapOutputs, c CommonConf) error

func DestroyOrgStage

func DestroyOrgStage(t testing.TB, s steps.Steps, outputs BootstrapOutputs, c CommonConf) error

func DestroyProjectsStage

func DestroyProjectsStage(t testing.TB, s steps.Steps, outputs BootstrapOutputs, c CommonConf) error

func GetNetworkStep

func GetNetworkStep(enableHubAndSpoke bool) string

func TerraformVet

func TerraformVet(t testing.TB, terraformDir, policyPath, project string) error

TerraformVet runs gcloud terraform vet on the plan of the provided terraform directory

func ValidateBasicFields

func ValidateBasicFields(t testing.TB, g GlobalTFVars)

ValidateBasicFields validates if the values for the required field were provided

func ValidateDestroyFlags

func ValidateDestroyFlags(t testing.TB, g GlobalTFVars)

ValidateDestroyFlags checks if the flags to allow the destruction of the infrastructure are enabled

func ValidateDirectories

func ValidateDirectories(g GlobalTFVars) error

ValidateDirectories checks if the required directories exist

Types

type AppInfraCommonTfvars

type AppInfraCommonTfvars struct {
	InstanceRegion    string `hcl:"instance_region"`
	RemoteStateBucket string `hcl:"remote_state_bucket"`
}

type BootstrapOutputs

type BootstrapOutputs struct {
	RemoteStateBucket         string
	RemoteStateBucketProjects string
	CICDProject               string
	DefaultRegion             string
	NetworkSA                 string
	ProjectsSA                string
	EnvsSA                    string
	OrgSA                     string
	BootstrapSA               string
	RequiredGroups            map[string]string
}

func GetBootstrapStepOutputs

func GetBootstrapStepOutputs(t testing.TB, foundationPath string) BootstrapOutputs

type BootstrapTfvars

type BootstrapTfvars struct {
	OrgID                        string  `hcl:"org_id"`
	BillingAccount               string  `hcl:"billing_account"`
	DefaultRegion                string  `hcl:"default_region"`
	ParentFolder                 *string `hcl:"parent_folder"`
	ProjectPrefix                *string `hcl:"project_prefix"`
	FolderPrefix                 *string `hcl:"folder_prefix"`
	BucketForceDestroy           *bool   `hcl:"bucket_force_destroy"`
	BucketTfstateKmsForceDestroy *bool   `hcl:"bucket_tfstate_kms_force_destroy"`
	Groups                       Groups  `hcl:"groups"`
	InitialGroupConfig           *string `hcl:"initial_group_config"`
}

type CommonConf

type CommonConf struct {
	FoundationPath    string
	CheckoutPath      string
	PolicyPath        string
	ValidatorProject  string
	EnableHubAndSpoke bool
	DisablePrompt     bool
	Logger            *logger.Logger
}

type EnvsTfvars

type EnvsTfvars struct {
	RemoteStateBucket string `hcl:"remote_state_bucket"`
}

type GcpGroups

type GcpGroups struct {
	SecurityReviewer   *string `cty:"security_reviewer"`
	NetworkViewer      *string `cty:"network_viewer"`
	SccAdmin           *string `cty:"scc_admin"`
	GlobalSecretsAdmin *string `cty:"global_secrets_admin"`
	KmsAdmin           *string `cty:"kms_admin"`
}

type GlobalTFVars

type GlobalTFVars struct {
	OrgID                                 string          `hcl:"org_id"`
	BillingAccount                        string          `hcl:"billing_account"`
	DefaultRegion                         string          `hcl:"default_region"`
	ParentFolder                          *string         `hcl:"parent_folder"`
	Domain                                string          `hcl:"domain"`
	DomainsToAllow                        []string        `hcl:"domains_to_allow"`
	EssentialContactsDomains              []string        `hcl:"essential_contacts_domains_to_allow"`
	PerimeterAdditionalMembers            []string        `hcl:"perimeter_additional_members"`
	TargetNameServerAddresses             []ServerAddress `hcl:"target_name_server_addresses"`
	SccNotificationName                   string          `hcl:"scc_notification_name"`
	ProjectPrefix                         *string         `hcl:"project_prefix"`
	FolderPrefix                          *string         `hcl:"folder_prefix"`
	CaiMonitoringKmsForceDestroy          *bool           `hcl:"cai_monitoring_kms_force_destroy"`
	BucketForceDestroy                    *bool           `hcl:"bucket_force_destroy"`
	BucketTfstateKmsForceDestroy          *bool           `hcl:"bucket_tfstate_kms_force_destroy"`
	AuditLogsTableDeleteContentsOnDestroy *bool           `hcl:"audit_logs_table_delete_contents_on_destroy"`
	LogExportStorageForceDestroy          *bool           `hcl:"log_export_storage_force_destroy"`
	LogExportStorageLocation              string          `hcl:"log_export_storage_location"`
	BillingExportDatasetLocation          string          `hcl:"billing_export_dataset_location"`
	EnableHubAndSpoke                     bool            `hcl:"enable_hub_and_spoke"`
	EnableHubAndSpokeTransitivity         bool            `hcl:"enable_hub_and_spoke_transitivity"`
	CreateUniqueTagKey                    bool            `hcl:"create_unique_tag_key"`
	ProjectsKMSLocation                   string          `hcl:"projects_kms_location"`
	ProjectsGCSLocation                   string          `hcl:"projects_gcs_location"`
	CodeCheckoutPath                      string          `hcl:"code_checkout_path"`
	FoundationCodePath                    string          `hcl:"foundation_code_path"`
	ValidatorProjectId                    *string         `hcl:"validator_project_id"`
	Groups                                Groups          `hcl:"groups"`
	InitialGroupConfig                    *string         `hcl:"initial_group_config"`
}

GlobalTFVars contains all the configuration for the deploy

func ReadGlobalTFVars

func ReadGlobalTFVars(file string) (GlobalTFVars, error)

ReadGlobalTFVars reads the tfvars file that has all the configuration for the deploy

func (GlobalTFVars) CheckString

func (g GlobalTFVars) CheckString(s string)

CheckString checks if any of the string fields in the GlobalTFVars has the given string

func (GlobalTFVars) HasGroupsCreation

func (g GlobalTFVars) HasGroupsCreation() bool

HasGroupsCreation checks if Groups creation is enabled

func (GlobalTFVars) HasOptionalGroupsCreation

func (g GlobalTFVars) HasOptionalGroupsCreation() bool

HasOptionalGroupsCreation checks if Optional Groups creation is enabled

func (GlobalTFVars) HasRequiredGroupsCreation

func (g GlobalTFVars) HasRequiredGroupsCreation() bool

HasRequiredGroupsCreation checks if Required Groups creation is enabled

func (GlobalTFVars) HasValidatorProj

func (g GlobalTFVars) HasValidatorProj() bool

HasValidatorProj checks if a Validator Project was provided

type Groups

type Groups struct {
	CreateRequiredGroups *bool           `cty:"create_required_groups"`
	CreateOptionalGroups *bool           `cty:"create_optional_groups"`
	BillingProject       *string         `cty:"billing_project"`
	RequiredGroups       RequiredGroups  `cty:"required_groups"`
	OptionalGroups       *OptionalGroups `cty:"optional_groups"`
}

type InfraPipelineOutputs

type InfraPipelineOutputs struct {
	RemoteStateBucket string
	InfraPipeProj     string
	DefaultRegion     string
	TerraformSA       string
	StateBucket       string
}

func GetInfraPipelineOutputs

func GetInfraPipelineOutputs(t testing.TB, checkoutPath, workspace string) InfraPipelineOutputs

type NetAccessContextTfvars

type NetAccessContextTfvars struct {
	AccessContextManagerPolicyID string `hcl:"access_context_manager_policy_id"`
}

type NetCommonTfvars

type NetCommonTfvars struct {
	Domain                        string   `hcl:"domain"`
	PerimeterAdditionalMembers    []string `hcl:"perimeter_additional_members"`
	RemoteStateBucket             string   `hcl:"remote_state_bucket"`
	EnableHubAndSpokeTransitivity *bool    `hcl:"enable_hub_and_spoke_transitivity"`
}

type NetSharedTfvars

type NetSharedTfvars struct {
	TargetNameServerAddresses []ServerAddress `hcl:"target_name_server_addresses"`
}

type OptionalGroups

type OptionalGroups struct {
	GcpSecurityReviewer   *string `cty:"gcp_security_reviewer"`
	GcpNetworkViewer      *string `cty:"gcp_network_viewer"`
	GcpSccAdmin           *string `cty:"gcp_scc_admin"`
	GcpGlobalSecretsAdmin *string `cty:"gcp_global_secrets_admin"`
	GcpKmsAdmin           *string `cty:"gcp_kms_admin"`
}

type OrgTfvars

type OrgTfvars struct {
	DomainsToAllow                        []string  `hcl:"domains_to_allow"`
	EssentialContactsDomains              []string  `hcl:"essential_contacts_domains_to_allow"`
	SccNotificationName                   string    `hcl:"scc_notification_name"`
	RemoteStateBucket                     string    `hcl:"remote_state_bucket"`
	EnableHubAndSpoke                     bool      `hcl:"enable_hub_and_spoke"`
	CreateACMAPolicy                      bool      `hcl:"create_access_context_manager_access_policy"`
	CreateUniqueTagKey                    bool      `hcl:"create_unique_tag_key"`
	CaiMonitoringKmsForceDestroy          *bool     `hcl:"cai_monitoring_kms_force_destroy"`
	AuditLogsTableDeleteContentsOnDestroy *bool     `hcl:"audit_logs_table_delete_contents_on_destroy"`
	LogExportStorageForceDestroy          *bool     `hcl:"log_export_storage_force_destroy"`
	LogExportStorageLocation              string    `hcl:"log_export_storage_location"`
	BillingExportDatasetLocation          string    `hcl:"billing_export_dataset_location"`
	GcpGroups                             GcpGroups `hcl:"gcp_groups"`
}

type ProjCommonTfvars

type ProjCommonTfvars struct {
	RemoteStateBucket string `hcl:"remote_state_bucket"`
}

type ProjEnvTfvars

type ProjEnvTfvars struct {
	ProjectsKMSLocation string `hcl:"projects_kms_location"`
	ProjectsGCSLocation string `hcl:"projects_gcs_location"`
}

type ProjSharedTfvars

type ProjSharedTfvars struct {
	DefaultRegion string `hcl:"default_region"`
}

type RequiredGroups

type RequiredGroups struct {
	GroupOrgAdmins           string `cty:"group_org_admins"`
	GroupBillingAdmins       string `cty:"group_billing_admins"`
	BillingDataUsers         string `cty:"billing_data_users"`
	AuditDataUsers           string `cty:"audit_data_users"`
	MonitoringWorkspaceUsers string `cty:"monitoring_workspace_users"`
}

type ServerAddress

type ServerAddress struct {
	Ipv4Address    string `cty:"ipv4_address"`
	ForwardingPath string `cty:"forwarding_path"`
}

ServerAddress is the element for TargetNameServerAddresses

type StageConf

type StageConf struct {
	Stage               string
	StageSA             string
	CICDProject         string
	DefaultRegion       string
	Step                string
	Repo                string
	CustomTargetDirPath string
	GitConf             utils.GitRepo
	HasManualStep       bool
	GroupingUnits       []string
	Envs                []string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL