tests

package
v0.0.0-...-fd6796e Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CommonGcpCredentials = gcloud.Credentials{
	Credentials: api.Credentials{
		Credentials: "${auth:gcloud}",
	},
	ServiceAccountConfig: gcloud.ServiceAccountConfig{
		ProjectId: "${auth:gcloud.projectId}",
	},
}
View Source
var CommonKubernetesCredentials = k8s.KubernetesConfig{
	Kubeconfig: "${auth:kubernetes}",
}
View Source
var CommonSecretsDescriptor = &api.SecretsDescriptor{
	SchemaVersion: api.SecretsSchemaVersion,
	Auth: map[string]api.AuthDescriptor{
		"gcloud": {
			Type: gcloud.AuthTypeGCPServiceAccount,
			Config: api.Config{Config: &gcloud.Credentials{
				Credentials: api.Credentials{
					Credentials: "<gcloud-service-account-email>",
				},
				ServiceAccountConfig: gcloud.ServiceAccountConfig{
					ProjectId: "test-gcp-project",
				},
			}},
		},
		"aws": {
			Type: aws.AuthTypeAWSToken,
			Config: api.Config{Config: &aws.AccountConfig{
				Account:         "000",
				AccessKey:       "<aws-access-key>",
				SecretAccessKey: "<aws-secret-key>",
			}},
		},
		"pulumi": {
			Type: pulumi.AuthTypePulumiToken,
			Config: api.Config{Config: &pulumi.TokenAuthDescriptor{
				Credentials: "<pulumi-token>",
			}},
		},
		"kubernetes": {
			Type: k8s.AuthTypeKubeconfig,
			Config: api.Config{Config: &k8s.KubernetesConfig{
				Kubeconfig: "<kube-config>",
			}},
		},
	},
	Values: map[string]string{
		"CLOUDFLARE_API_TOKEN":      "<encrypted-secret>",
		"GITHUB_TOKEN":              "<encrypted-secret>",
		"MONGODB_ATLAS_PRIVATE_KEY": "<encrypted-secret>",
		"MONGODB_ATLAS_PUBLIC_KEY":  "<encrypted-secret>",
		"JWT_SECRET":                "<encrypted-secret>",
		"docker-registry-password":  "test-pass",
		"docker-registry-username":  "test-user",
	},
}
View Source
var CommonServerDescriptor = &api.ServerDescriptor{
	SchemaVersion: api.ServerSchemaVersion,
	Provisioner: api.ProvisionerDescriptor{
		Type: pulumi.ProvisionerTypePulumi,
		Config: api.Config{Config: &pulumi.ProvisionerConfig{
			StateStorage: pulumi.StateStorageConfig{
				Type: pulumi.StateStorageTypeGcpBucket,
				Config: api.Config{Config: &gcloud.StateStorageConfig{
					Credentials: CommonGcpCredentials,
					Provision:   true,
				}},
			},
			SecretsProvider: pulumi.SecretsProviderConfig{
				Type: pulumi.SecretsProviderTypeGcpKms,
				Config: api.Config{Config: &gcloud.SecretsProviderConfig{
					Credentials: CommonGcpCredentials,
					Provision:   true,
					KeyName:     "mypulumi-base-kms-key",
					KeyLocation: "global",
				}},
			},
		}},
	},
	CiCd: api.CiCdDescriptor{
		Type: "github-actions",
		Config: api.Config{Config: &github.GitHubActionsCiCdConfig{
			Organization: "simple-container-org",
			Environments: map[string]github.GitHubEnvironmentConfig{
				"staging": {
					Type:        "staging",
					Runner:      "",
					Protection:  false,
					Reviewers:   nil,
					Secrets:     nil,
					Variables:   nil,
					DeployFlags: nil,
					AutoDeploy:  false,
				},
				"production": {
					Type:        "production",
					Runner:      "",
					Protection:  false,
					Reviewers:   nil,
					Secrets:     nil,
					Variables:   nil,
					DeployFlags: nil,
					AutoDeploy:  false,
				},
			},
			Notifications: github.GitHubNotificationConfig{
				Slack: github.SlackNotificationConfig{
					WebhookURL: "",
					Enabled:    false,
				},
				Discord: github.DiscordNotificationConfig{
					WebhookURL: "",
					Enabled:    false,
				},
				Telegram: github.TelegramNotificationConfig{
					BotToken: "",
					ChatID:   "",
					Enabled:  false,
				},
			},
			WorkflowGeneration: github.GitHubWorkflowConfig{
				Enabled:       false,
				OutputPath:    "",
				Templates:     []string{"deploy", "destroy"},
				AutoUpdate:    false,
				CustomActions: map[string]string{},
				SCVersion:     "",
			},
		}},
	},
	Secrets: api.SecretsConfigDescriptor{
		Type: gcloud.SecretsTypeGCPSecretsManager,
		Config: api.Config{Config: &gcloud.SecretsProviderConfig{
			Credentials: gcloud.Credentials{
				Credentials: api.Credentials{
					Credentials: "${auth:gcloud}",
				},
				ServiceAccountConfig: gcloud.ServiceAccountConfig{
					ProjectId: "${auth:gcloud.projectId}",
				},
			},
		}},
	},
	Templates: map[string]api.StackDescriptor{
		"stack-per-app-aws": {
			Type: aws.TemplateTypeEcsFargate,
			Config: api.Config{Config: &aws.TemplateConfig{
				AccountConfig: awsAccountConfig,
			}},
		},
		"stack-per-app": {
			Type: gcloud.TemplateTypeGcpCloudrun,
			Config: api.Config{Config: &gcloud.TemplateConfig{
				Credentials: gcloud.Credentials{
					Credentials: api.Credentials{
						Credentials: "${auth:gcloud}",
					},
					ServiceAccountConfig: gcloud.ServiceAccountConfig{
						ProjectId: "${auth:gcloud.projectId}",
					},
				},
			}},
		},
	},
	Resources: api.PerStackResourcesDescriptor{
		Registrar: api.RegistrarDescriptor{
			Type: cloudflare.RegistrarType,
			Config: api.Config{Config: &cloudflare.RegistrarConfig{
				AuthConfig: cloudflare.AuthConfig{
					Credentials: api.Credentials{
						Credentials: "${secret:CLOUDFLARE_API_TOKEN}",
					},
					AccountId: "12345",
				},
				ZoneName: "sc-refapp.org",
				Records: []api.DnsRecord{
					{
						Name:  "@",
						Type:  "TXT",
						Value: "MS=ms83691649",
					},
				},
			}},
		},
	},
}
View Source
var CommonStack = api.Stack{
	Name:    "common",
	Secrets: *CommonSecretsDescriptor,
	Server:  *CommonServerDescriptor,
}
View Source
var RefappAwsClientDescriptor = &api.ClientDescriptor{
	SchemaVersion: api.ClientSchemaVersion,
	Stacks: map[string]api.StackClientDescriptor{
		"staging": {
			Type:        api.ClientTypeCloudCompose,
			ParentStack: "refapp-aws",
			Config: api.Config{
				Config: RefappClientComposeConfigStaging,
			},
		},
		"prod": {
			Type:        api.ClientTypeCloudCompose,
			ParentStack: "refapp-aws",
			Config: api.Config{
				Config: RefappClientComposeConfigProd,
			},
		},
	},
}
View Source
var RefappAwsLambdaClientDescriptor = &api.ClientDescriptor{
	SchemaVersion: api.ClientSchemaVersion,
	Stacks: map[string]api.StackClientDescriptor{
		"staging": {
			Type:        api.ClientTypeSingleImage,
			ParentStack: "refapp-aws-lambda",
			Config: api.Config{
				Config: &api.StackConfigSingleImage{
					Domain: "staging.sc-refapp.org",
					Image: &api.ContainerImage{
						Dockerfile: "Dockerfile",
					},
					Env: map[string]string{
						"ENV": "staging",
					},
				},
			},
		},
		"prod": {
			Type:        api.ClientTypeSingleImage,
			ParentStack: "refapp-aws-lambda",
			Config: api.Config{
				Config: &api.StackConfigSingleImage{
					Domain: "prod.sc-refapp.org",
					Image: &api.ContainerImage{
						Dockerfile: "Dockerfile",
					},
					Env: map[string]string{
						"ENV": "prod",
					},
				},
			},
		},
	},
}
View Source
var RefappAwsLambdaServerDescriptor = &api.ServerDescriptor{
	SchemaVersion: api.ServerSchemaVersion,
	Provisioner: api.ProvisionerDescriptor{
		Inherit: api.Inherit{Inherit: "common"},
	},
	Secrets: api.SecretsConfigDescriptor{
		Inherit: api.Inherit{Inherit: "common"},
	},
	CiCd: api.CiCdDescriptor{
		Inherit: api.Inherit{Inherit: "common"},
	},
	Templates: map[string]api.StackDescriptor{
		"lambda-per-app": {
			Type: aws.TemplateTypeAwsLambda,
			Config: api.Config{Config: &aws.TemplateConfig{
				AccountConfig: aws.AccountConfig{
					Account: "${auth:aws.projectId}",
					Credentials: api.Credentials{
						Credentials: "${auth:aws}",
					},
				},
			}},
		},
	},
	Resources: api.PerStackResourcesDescriptor{
		Registrar: api.RegistrarDescriptor{
			Inherit: api.Inherit{Inherit: "common"},
		},
		Resources: map[string]api.PerEnvResourcesDescriptor{
			"staging": {
				Template: "lambda-per-app",
			},
			"prod": {
				Template: "lambda-per-app",
			},
		},
	},
}
View Source
var RefappAwsServerDescriptor = &api.ServerDescriptor{
	SchemaVersion: api.ServerSchemaVersion,
	Provisioner: api.ProvisionerDescriptor{
		Inherit: api.Inherit{Inherit: "common"},
	},
	Secrets: api.SecretsConfigDescriptor{
		Inherit: api.Inherit{Inherit: "common"},
	},
	CiCd: api.CiCdDescriptor{
		Inherit: api.Inherit{Inherit: "common"},
	},
	Templates: map[string]api.StackDescriptor{
		"stack-per-app-aws": {
			Inherit: api.Inherit{Inherit: "common"},
		},
	},
	Resources: api.PerStackResourcesDescriptor{
		Registrar: api.RegistrarDescriptor{
			Inherit: api.Inherit{Inherit: "common"},
		},
		Resources: map[string]api.PerEnvResourcesDescriptor{
			"staging": {
				Template: "stack-per-app-aws",
			},
			"prod": {
				Template: "stack-per-app-aws",
			},
		},
	},
}
View Source
var RefappAwsStack = api.Stack{
	Name:    "refapp-aws",
	Secrets: *CommonSecretsDescriptor,
	Server:  *RefappServerDescriptor,
	Client:  *RefappClientDescriptor,
}
View Source
var RefappClientComposeConfigProd = &api.StackConfigCompose{
	Domain:            "prod.sc-refapp.org",
	DockerComposeFile: "${git:root}/docker-compose.yaml",
	Uses: []string{
		"mongodb",
	},
	Runs: []string{
		"api",
		"ui",
	},
	Env:          map[string]string{},
	Secrets:      map[string]string{},
	Dependencies: []api.StackConfigDependencyResource{},
}
View Source
var RefappClientComposeConfigStaging = &api.StackConfigCompose{
	Domain:            "staging.sc-refapp.org",
	DockerComposeFile: "${git:root}/docker-compose.yaml",
	Uses: []string{
		"mongodb",
	},
	Runs: []string{
		"api",
		"ui",
	},
	Env:          map[string]string{},
	Secrets:      map[string]string{},
	Dependencies: []api.StackConfigDependencyResource{},
}
View Source
var RefappClientDescriptor = &api.ClientDescriptor{
	SchemaVersion: api.ClientSchemaVersion,
	Defaults:      map[string]interface{}{},
	Stacks: map[string]api.StackClientDescriptor{
		"staging": {
			Type:        api.ClientTypeCloudCompose,
			ParentStack: "refapp",
			Config: api.Config{
				Config: &api.StackConfigCompose{
					Domain:            "staging.sc-refapp.org",
					DockerComposeFile: "${git:root}/docker-compose.yaml",
					Uses: []string{
						"mongodb",
					},
					Runs: []string{
						"api",
						"ui",
					},
					Env: map[string]string{
						"JWT_SECRET": "${secret:JWT_SECRET}",
						"MONGO_URI":  "${resource:mongodb.uri}",
					},
					Secrets:      map[string]string{},
					Dependencies: []api.StackConfigDependencyResource{},
				},
			},
		},
		"prod": {
			Type:        api.ClientTypeCloudCompose,
			ParentStack: "refapp",
			Config: api.Config{
				Config: &api.StackConfigCompose{
					Domain:            "prod.sc-refapp.org",
					DockerComposeFile: "${git:root}/docker-compose.yaml",
					Uses: []string{
						"mongodb",
					},
					Runs: []string{
						"api",
						"ui",
					},
					Env: map[string]string{
						"JWT_SECRET": "${secret:JWT_SECRET}",
						"MONGO_URI":  "${resource:mongodb.uri}",
					},
					Secrets:      map[string]string{},
					Dependencies: []api.StackConfigDependencyResource{},
				},
			},
		},
	},
}
View Source
var RefappGkeAutopilotClientDescriptor = &api.ClientDescriptor{
	SchemaVersion: api.ClientSchemaVersion,
	Stacks: map[string]api.StackClientDescriptor{
		"staging": {
			Type:        api.ClientTypeCloudCompose,
			ParentStack: "refapp-gke-autopilot",
			Config: api.Config{
				Config: RefappClientComposeConfigStaging,
			},
		},
		"prod": {
			Type:        api.ClientTypeCloudCompose,
			ParentStack: "refapp-gke-autopilot",
			Config: api.Config{
				Config: RefappClientComposeConfigProd,
			},
		},
	},
}
View Source
var RefappGkeAutopilotServerDescriptor = &api.ServerDescriptor{
	SchemaVersion: api.ServerSchemaVersion,
	Provisioner: api.ProvisionerDescriptor{
		Inherit: api.Inherit{Inherit: "common"},
	},
	Secrets: api.SecretsConfigDescriptor{
		Inherit: api.Inherit{Inherit: "common"},
	},
	CiCd: api.CiCdDescriptor{
		Inherit: api.Inherit{Inherit: "common"},
	},
	Templates: map[string]api.StackDescriptor{
		"stack-per-app-gke": {
			Type: "gcp-gke-autopilot",
			Config: api.Config{
				Config: &gcloud.GkeAutopilotTemplate{
					Credentials:              CommonGcpCredentials,
					GkeClusterResource:       "gke-autopilot-res",
					ArtifactRegistryResource: "artifact-registry-res",
				},
			},
			Inherit: api.Inherit{},
		},
	},
	Resources: api.PerStackResourcesDescriptor{
		Registrar: api.RegistrarDescriptor{
			Inherit: api.Inherit{Inherit: "common"},
		},
		Resources: map[string]api.PerEnvResourcesDescriptor{
			"staging": {
				Template:  "stack-per-app-gke",
				Resources: RefappGkeAutopilotServerResources,
			},
			"prod": {
				Template:  "stack-per-app-gke",
				Resources: RefappGkeAutopilotServerResources,
			},
		},
	},
}
View Source
var RefappGkeAutopilotServerResources = map[string]api.ResourceDescriptor{
	"gke-autopilot-res": {
		Type: "gcp-gke-autopilot-cluster",
		Config: api.Config{
			Config: &gcloud.GkeAutopilotResource{
				Credentials:   CommonGcpCredentials,
				GkeMinVersion: "1.33.4-gke.1245000",
				Location:      "europe-west3",
			},
		},
		Inherit: api.Inherit{},
	},
	"artifact-registry-res": {
		Type: "gcp-artifact-registry",
		Config: api.Config{
			Config: &gcloud.ArtifactRegistryConfig{
				Credentials: CommonGcpCredentials,
				Location:    "europe-west3",
			},
		},
		Inherit: api.Inherit{},
	},
}
View Source
var RefappKubernetesClientDescriptor = &api.ClientDescriptor{
	SchemaVersion: api.ClientSchemaVersion,
	Stacks: map[string]api.StackClientDescriptor{
		"staging": {
			Type:        api.ClientTypeCloudCompose,
			ParentStack: "refapp-kubernetes",
			Config: api.Config{
				Config: RefappClientComposeConfigStaging,
			},
		},
		"prod": {
			Type:        api.ClientTypeCloudCompose,
			ParentStack: "refapp-kubernetes",
			Config: api.Config{
				Config: RefappClientComposeConfigProd,
			},
		},
	},
}
View Source
var RefappKubernetesServerDescriptor = &api.ServerDescriptor{
	SchemaVersion: api.ServerSchemaVersion,
	Provisioner: api.ProvisionerDescriptor{
		Inherit: api.Inherit{Inherit: "common"},
	},
	Secrets: api.SecretsConfigDescriptor{
		Inherit: api.Inherit{Inherit: "common"},
	},
	CiCd: api.CiCdDescriptor{
		Inherit: api.Inherit{Inherit: "common"},
	},
	Templates: map[string]api.StackDescriptor{
		"stack-per-app-k8s": {
			Type: k8s.TemplateTypeKubernetesCloudrun,
			Config: api.Config{
				Config: &k8s.CloudrunTemplate{
					KubernetesConfig: k8s.KubernetesConfig{
						Kubeconfig: "${auth:kubernetes}",
					},
					RegistryCredentials: docker.RegistryCredentials{
						DockerRegistryURL:      lo.ToPtr("index.docker.io"),
						DockerRegistryUsername: lo.ToPtr("${secret:docker-registry-username}"),
						DockerRegistryPassword: lo.ToPtr("${secret:docker-registry-password}"),
					},
					CaddyResource: lo.ToPtr("caddy"),
				},
			},
			Inherit: api.Inherit{},
		},
	},
	Resources: api.PerStackResourcesDescriptor{
		Registrar: api.RegistrarDescriptor{
			Inherit: api.Inherit{Inherit: "common"},
		},
		Resources: map[string]api.PerEnvResourcesDescriptor{
			"staging": {
				Template:  "stack-per-app-k8s",
				Resources: RefappKubernetesServerResources,
			},
		},
	},
}
View Source
var RefappKubernetesServerResources = map[string]api.ResourceDescriptor{
	"caddy": {
		Type: k8s.ResourceTypeCaddy,
		Config: api.Config{Config: &k8s.CaddyResource{
			KubernetesConfig: &k8s.KubernetesConfig{
				Kubeconfig: "${auth:kubernetes}",
			},
			CaddyConfig: &k8s.CaddyConfig{
				Enable:    lo.ToPtr(true),
				Namespace: lo.ToPtr("caddy"),
				Replicas:  lo.ToPtr(2),
			},
		}},
	},
}
View Source
var RefappServerDescriptor = &api.ServerDescriptor{
	SchemaVersion: api.ServerSchemaVersion,
	Provisioner: api.ProvisionerDescriptor{
		Inherit: api.Inherit{Inherit: "common"},
	},
	Secrets: api.SecretsConfigDescriptor{
		Inherit: api.Inherit{Inherit: "common"},
	},
	CiCd: api.CiCdDescriptor{
		Inherit: api.Inherit{Inherit: "common"},
	},
	Templates: map[string]api.StackDescriptor{
		"stack-per-app": {
			Inherit: api.Inherit{Inherit: "common"},
		},
	},
	Variables: map[string]api.VariableDescriptor{
		"atlas-region": {
			Type:  "string",
			Value: "US_SOUTH_1",
		},
		"atlas-project-id": {
			Type:  "string",
			Value: "5b89110a4e6581562623c59c",
		},
		"atlas-org-id": {
			Type:  "string",
			Value: "5b89110a4e6581562623c59c",
		},
		"atlas-instance-size": {
			Type:  "string",
			Value: "M10",
		},
	},
	Resources: api.PerStackResourcesDescriptor{
		Registrar: api.RegistrarDescriptor{
			Inherit: api.Inherit{Inherit: "common"},
		},
		Resources: map[string]api.PerEnvResourcesDescriptor{
			"staging": {
				Template: "stack-per-app",
				Resources: map[string]api.ResourceDescriptor{
					"mongodb": mongodbAtlasResourceConfig,
					"postgres": {
						Type: gcloud.ResourceTypePostgresGcpCloudsql,
						Config: api.Config{Config: &gcloud.PostgresGcpCloudsqlConfig{
							Version: "14.5",
							Project: "${stack:name}",
							Credentials: gcloud.Credentials{
								Credentials: api.Credentials{
									Credentials: "${auth:gcloud}",
								},
								ServiceAccountConfig: gcloud.ServiceAccountConfig{
									ProjectId: "${auth:gcloud.projectId}",
								},
							},
						}},
					},
				},
			},
			"prod": {
				Template: "stack-per-app",
				Resources: map[string]api.ResourceDescriptor{
					"mongodb": mongodbAtlasResourceConfig,
					"postgres": {
						Type: "gcp-cloudsql-postgres",
						Config: api.Config{Config: &gcloud.PostgresGcpCloudsqlConfig{
							Version: "14.5",
							Project: "${stack:name}",
							Credentials: gcloud.Credentials{
								Credentials: api.Credentials{
									Credentials: "${auth:gcloud}",
								},
								ServiceAccountConfig: gcloud.ServiceAccountConfig{
									ProjectId: "${auth:gcloud.projectId}",
								},
							},
						}},
					},
				},
			},
		},
	},
}
View Source
var RefappStack = api.Stack{
	Name:    "refapp",
	Secrets: *CommonSecretsDescriptor,
	Server:  *RefappServerDescriptor,
	Client:  *RefappClientDescriptor,
}
View Source
var RefappStaticGCPClientDescriptor = &api.ClientDescriptor{
	SchemaVersion: api.ClientSchemaVersion,
	Stacks: map[string]api.StackClientDescriptor{
		"staging": {
			Type:        api.ClientTypeStatic,
			ParentStack: "refapp-static-gcp",
			Config: api.Config{
				Config: &api.StackConfigStatic{
					BundleDir: "./bundle",
					Site: api.StaticSiteConfig{
						Domain: "staging.sc-refapp.org",
					},
				},
			},
		},
		"prod": {
			Type:        api.ClientTypeStatic,
			ParentStack: "refapp-static-gcp",
			Config: api.Config{
				Config: &api.StackConfigStatic{
					BundleDir: "./bundle",
					Site: api.StaticSiteConfig{
						Domain: "prod.sc-refapp.org",
					},
				},
			},
		},
	},
}
View Source
var RefappStaticGCPServerDescriptor = &api.ServerDescriptor{
	SchemaVersion: api.ServerSchemaVersion,
	Provisioner: api.ProvisionerDescriptor{
		Inherit: api.Inherit{Inherit: "common"},
	},
	Secrets: api.SecretsConfigDescriptor{
		Inherit: api.Inherit{Inherit: "common"},
	},
	CiCd: api.CiCdDescriptor{
		Inherit: api.Inherit{Inherit: "common"},
	},
	Templates: map[string]api.StackDescriptor{
		"static-website": {
			Type: gcloud.TemplateTypeStaticWebsite,
			Config: api.Config{Config: &gcloud.TemplateConfig{
				Credentials: gcloud.Credentials{
					Credentials: api.Credentials{
						Credentials: "${auth:gcloud}",
					},
					ServiceAccountConfig: gcloud.ServiceAccountConfig{
						ProjectId: "${auth:gcloud.projectId}",
					},
				},
			}},
			Inherit: api.Inherit{},
		},
	},
	Resources: api.PerStackResourcesDescriptor{
		Registrar: api.RegistrarDescriptor{
			Inherit: api.Inherit{Inherit: "common"},
		},
		Resources: map[string]api.PerEnvResourcesDescriptor{
			"staging": {
				Template: "static-website",
			},
			"prod": {
				Template: "static-website",
			},
		},
	},
}
View Source
var ResolvedCommonGcpCredentials = gcloud.Credentials{
	Credentials: api.Credentials{
		Credentials: "<gcloud-service-account-email>",
	},
	ServiceAccountConfig: gcloud.ServiceAccountConfig{
		ProjectId: "test-gcp-project",
	},
}
View Source
var ResolvedCommonServerDescriptor = &api.ServerDescriptor{
	SchemaVersion: api.ServerSchemaVersion,
	Provisioner: api.ProvisionerDescriptor{
		Type: pulumi.ProvisionerTypePulumi,
		Config: api.Config{Config: &pulumi.ProvisionerConfig{
			StateStorage: pulumi.StateStorageConfig{
				Type: pulumi.StateStorageTypeGcpBucket,
				Config: api.Config{Config: &gcloud.StateStorageConfig{
					Credentials: ResolvedCommonGcpCredentials,
					Provision:   true,
				}},
			},
			SecretsProvider: pulumi.SecretsProviderConfig{
				Type: pulumi.SecretsProviderTypeGcpKms,
				Config: api.Config{Config: &gcloud.SecretsProviderConfig{
					Credentials: ResolvedCommonGcpCredentials,
					KeyName:     "mypulumi-base-kms-key",
					KeyLocation: "global",
					Provision:   true,
				}},
			},
		}},
	},
	CiCd: api.CiCdDescriptor{
		Type: "github-actions",
		Config: api.Config{Config: &github.GitHubActionsCiCdConfig{
			Organization: "simple-container-org",
			Environments: map[string]github.GitHubEnvironmentConfig{
				"staging": {
					Type:        "staging",
					Runner:      "",
					Protection:  false,
					Reviewers:   []string{},
					Secrets:     []string{},
					Variables:   map[string]string{},
					DeployFlags: []string{},
					AutoDeploy:  false,
				},
				"production": {
					Type:        "production",
					Runner:      "",
					Protection:  false,
					Reviewers:   []string{},
					Secrets:     []string{},
					Variables:   map[string]string{},
					DeployFlags: []string{},
					AutoDeploy:  false,
				},
			},
			Notifications: github.GitHubNotificationConfig{
				Slack: github.SlackNotificationConfig{
					WebhookURL: "",
					Enabled:    false,
				},
				Discord: github.DiscordNotificationConfig{
					WebhookURL: "",
					Enabled:    false,
				},
				Telegram: github.TelegramNotificationConfig{
					BotToken: "",
					ChatID:   "",
					Enabled:  false,
				},
			},
			WorkflowGeneration: github.GitHubWorkflowConfig{
				Enabled:       false,
				OutputPath:    "",
				Templates:     []string{"deploy", "destroy"},
				AutoUpdate:    false,
				CustomActions: map[string]string{},
				SCVersion:     "",
			},
		}},
	},
	Secrets: api.SecretsConfigDescriptor{
		Type: gcloud.SecretsTypeGCPSecretsManager,
		Config: api.Config{Config: &gcloud.SecretsProviderConfig{
			Credentials: ResolvedCommonGcpCredentials,
		}},
	},
	Templates: map[string]api.StackDescriptor{
		"stack-per-app-aws": {
			Type: aws.TemplateTypeEcsFargate,
			Config: api.Config{Config: &aws.TemplateConfig{
				AccountConfig: resolvedAwsAccountConfig,
			}},
		},
		"stack-per-app": {
			Type: gcloud.TemplateTypeGcpCloudrun,
			Config: api.Config{Config: &gcloud.TemplateConfig{
				Credentials: ResolvedCommonGcpCredentials,
			}},
		},
	},
	Resources: api.PerStackResourcesDescriptor{
		Registrar: api.RegistrarDescriptor{
			Type: cloudflare.RegistrarType,
			Config: api.Config{Config: &cloudflare.RegistrarConfig{
				AuthConfig: cloudflare.AuthConfig{
					Credentials: api.Credentials{
						Credentials: "<encrypted-secret>",
					},
					AccountId: "12345",
				},
				ZoneName: "sc-refapp.org",
				Records: []api.DnsRecord{
					{
						Name:  "@",
						Type:  "TXT",
						Value: "MS=ms83691649",
					},
				},
			}},
		},
		Resources: map[string]api.PerEnvResourcesDescriptor{},
	},
	Variables: map[string]api.VariableDescriptor{},
}
View Source
var ResolvedRefappAwsLambdaServerDescriptor = &api.ServerDescriptor{
	SchemaVersion: api.ServerSchemaVersion,
	Provisioner:   ResolvedCommonServerDescriptor.Provisioner,
	Secrets:       ResolvedCommonServerDescriptor.Secrets,
	CiCd:          ResolvedCommonServerDescriptor.CiCd,
	Templates: map[string]api.StackDescriptor{
		"lambda-per-app": {
			Type: aws.TemplateTypeAwsLambda,
			Config: api.Config{Config: &aws.TemplateConfig{
				AccountConfig: resolvedAwsAccountConfig,
			}},
		},
	},
	Variables: map[string]api.VariableDescriptor{},
	Resources: api.PerStackResourcesDescriptor{
		Registrar: ResolvedCommonServerDescriptor.Resources.Registrar,
		Resources: map[string]api.PerEnvResourcesDescriptor{
			"staging": {
				Template:  "lambda-per-app",
				Resources: map[string]api.ResourceDescriptor{},
			},
			"prod": {
				Template:  "lambda-per-app",
				Resources: map[string]api.ResourceDescriptor{},
			},
		},
	},
}
View Source
var ResolvedRefappAwsServerDescriptor = &api.ServerDescriptor{
	SchemaVersion: api.ServerSchemaVersion,
	Provisioner:   ResolvedCommonServerDescriptor.Provisioner,
	Secrets:       ResolvedCommonServerDescriptor.Secrets,
	CiCd:          ResolvedCommonServerDescriptor.CiCd,
	Templates: map[string]api.StackDescriptor{
		"stack-per-app-aws": ResolvedCommonServerDescriptor.Templates["stack-per-app-aws"],
	},
	Variables: map[string]api.VariableDescriptor{},
	Resources: api.PerStackResourcesDescriptor{
		Registrar: ResolvedCommonServerDescriptor.Resources.Registrar,
		Resources: map[string]api.PerEnvResourcesDescriptor{
			"staging": {
				Template:  "stack-per-app-aws",
				Resources: map[string]api.ResourceDescriptor{},
			},
			"prod": {
				Template:  "stack-per-app-aws",
				Resources: map[string]api.ResourceDescriptor{},
			},
		},
	},
}
View Source
var ResolvedRefappGkeAutopilotServerDescriptor = &api.ServerDescriptor{
	SchemaVersion: api.ServerSchemaVersion,
	Provisioner:   ResolvedCommonServerDescriptor.Provisioner,
	Secrets:       ResolvedCommonServerDescriptor.Secrets,
	CiCd:          ResolvedCommonServerDescriptor.CiCd,
	Templates: map[string]api.StackDescriptor{
		"stack-per-app-gke": {
			Type: "gcp-gke-autopilot",
			Config: api.Config{
				Config: &gcloud.GkeAutopilotTemplate{
					Credentials:              ResolvedCommonGcpCredentials,
					ArtifactRegistryResource: "artifact-registry-res",
					GkeClusterResource:       "gke-autopilot-res",
				},
			},
			Inherit: api.Inherit{},
		},
	},
	Variables: map[string]api.VariableDescriptor{},
	Resources: api.PerStackResourcesDescriptor{
		Registrar: ResolvedCommonServerDescriptor.Resources.Registrar,
		Resources: map[string]api.PerEnvResourcesDescriptor{
			"staging": {
				Template:  "stack-per-app-gke",
				Resources: ResolvedRefappGkeAutopilotServerResources,
			},
			"prod": {
				Template:  "stack-per-app-gke",
				Resources: ResolvedRefappGkeAutopilotServerResources,
			},
		},
	},
}
View Source
var ResolvedRefappGkeAutopilotServerResources = map[string]api.ResourceDescriptor{
	"gke-autopilot-res": {
		Type: "gcp-gke-autopilot-cluster",
		Config: api.Config{
			Config: &gcloud.GkeAutopilotResource{
				Credentials:   ResolvedCommonGcpCredentials,
				GkeMinVersion: "1.33.4-gke.1245000",
				Location:      "europe-west3",
			},
		},
		Inherit: api.Inherit{},
	},
	"artifact-registry-res": {
		Type: "gcp-artifact-registry",
		Config: api.Config{
			Config: &gcloud.ArtifactRegistryConfig{
				Credentials: ResolvedCommonGcpCredentials,
				Location:    "europe-west3",
			},
		},
		Inherit: api.Inherit{},
	},
}
View Source
var ResolvedRefappKubernetesServerDescriptor = &api.ServerDescriptor{
	SchemaVersion: api.ServerSchemaVersion,
	Provisioner:   ResolvedCommonServerDescriptor.Provisioner,
	Secrets:       ResolvedCommonServerDescriptor.Secrets,
	CiCd:          ResolvedCommonServerDescriptor.CiCd,
	Templates: map[string]api.StackDescriptor{
		"stack-per-app-k8s": {
			Type: "kubernetes-cloudrun",
			Config: api.Config{
				Config: &k8s.CloudrunTemplate{
					KubernetesConfig: k8s.KubernetesConfig{
						Kubeconfig: "<kube-config>",
					},
					RegistryCredentials: docker.RegistryCredentials{
						DockerRegistryURL:      lo.ToPtr("index.docker.io"),
						DockerRegistryUsername: lo.ToPtr("test-user"),
						DockerRegistryPassword: lo.ToPtr("test-pass"),
					},
					CaddyResource: lo.ToPtr("caddy"),
				},
			},
			Inherit: api.Inherit{},
		},
	},
	Variables: map[string]api.VariableDescriptor{},
	Resources: api.PerStackResourcesDescriptor{
		Registrar: ResolvedCommonServerDescriptor.Resources.Registrar,
		Resources: map[string]api.PerEnvResourcesDescriptor{
			"staging": {
				Template:  "stack-per-app-k8s",
				Resources: ResolvedRefappKubernetesServerResources,
			},
		},
	},
}
View Source
var ResolvedRefappKubernetesServerResources = map[string]api.ResourceDescriptor{
	"caddy": {
		Type: k8s.ResourceTypeCaddy,
		Config: api.Config{Config: &k8s.CaddyResource{
			KubernetesConfig: &k8s.KubernetesConfig{
				Kubeconfig: "<kube-config>",
			},
			CaddyConfig: &k8s.CaddyConfig{
				Enable:    lo.ToPtr(true),
				Namespace: lo.ToPtr("caddy"),
				Replicas:  lo.ToPtr(2),
			},
		}},
	},
}
View Source
var ResolvedRefappServerDescriptor = &api.ServerDescriptor{
	SchemaVersion: api.ServerSchemaVersion,
	Provisioner:   ResolvedCommonServerDescriptor.Provisioner,
	Secrets:       ResolvedCommonServerDescriptor.Secrets,
	CiCd:          ResolvedCommonServerDescriptor.CiCd,
	Templates: map[string]api.StackDescriptor{
		"stack-per-app": ResolvedCommonServerDescriptor.Templates["stack-per-app"],
	},
	Variables: map[string]api.VariableDescriptor{
		"atlas-region": {
			Type:  "string",
			Value: "US_SOUTH_1",
		},
		"atlas-project-id": {
			Type:  "string",
			Value: "5b89110a4e6581562623c59c",
		},
		"atlas-org-id": {
			Type:  "string",
			Value: "5b89110a4e6581562623c59c",
		},
		"atlas-instance-size": {
			Type:  "string",
			Value: "M10",
		},
	},
	Resources: api.PerStackResourcesDescriptor{
		Registrar: ResolvedCommonServerDescriptor.Resources.Registrar,
		Resources: map[string]api.PerEnvResourcesDescriptor{
			"staging": {
				Template: "stack-per-app",
				Resources: map[string]api.ResourceDescriptor{
					"mongodb": resolvedMongodbAtlasResource,
					"postgres": {
						Type: gcloud.ResourceTypePostgresGcpCloudsql,
						Config: api.Config{Config: &gcloud.PostgresGcpCloudsqlConfig{
							Version: "14.5",
							Project: "refapp",
							Credentials: gcloud.Credentials{
								Credentials: api.Credentials{
									Credentials: "<gcloud-service-account-email>",
								},
								ServiceAccountConfig: gcloud.ServiceAccountConfig{
									ProjectId: "test-gcp-project",
								},
							},
						}},
					},
				},
			},
			"prod": {
				Template: "stack-per-app",
				Resources: map[string]api.ResourceDescriptor{
					"mongodb": resolvedMongodbAtlasResource,
					"postgres": {
						Type: gcloud.ResourceTypePostgresGcpCloudsql,
						Config: api.Config{Config: &gcloud.PostgresGcpCloudsqlConfig{
							Version: "14.5",
							Project: "refapp",
							Credentials: gcloud.Credentials{
								Credentials: api.Credentials{
									Credentials: "<gcloud-service-account-email>",
								},
								ServiceAccountConfig: gcloud.ServiceAccountConfig{
									ProjectId: "test-gcp-project",
								},
							},
						}},
					},
				},
			},
		},
	},
}
View Source
var ResolvedRefappStaticGCPServerDescriptor = &api.ServerDescriptor{
	SchemaVersion: api.ServerSchemaVersion,
	Provisioner:   ResolvedCommonServerDescriptor.Provisioner,
	Secrets:       ResolvedCommonServerDescriptor.Secrets,
	CiCd:          ResolvedCommonServerDescriptor.CiCd,
	Templates: map[string]api.StackDescriptor{
		"static-website": {
			Type: gcloud.TemplateTypeStaticWebsite,
			Config: api.Config{Config: &gcloud.TemplateConfig{
				Credentials: gcloud.Credentials{
					Credentials: api.Credentials{
						Credentials: "<gcloud-service-account-email>",
					},
					ServiceAccountConfig: gcloud.ServiceAccountConfig{
						ProjectId: "test-gcp-project",
					},
				},
			}},
		},
	},
	Variables: map[string]api.VariableDescriptor{},
	Resources: api.PerStackResourcesDescriptor{
		Registrar: ResolvedCommonServerDescriptor.Resources.Registrar,
		Resources: map[string]api.PerEnvResourcesDescriptor{
			"staging": {
				Template:  "static-website",
				Resources: map[string]api.ResourceDescriptor{},
			},
			"prod": {
				Template:  "static-website",
				Resources: map[string]api.ResourceDescriptor{},
			},
		},
	},
}

Functions

func ResolvedFsStateStorage

func ResolvedFsStateStorage() *fs.FileSystemStateStorage

func ResolvedFsStateStorageServerDescriptor

func ResolvedFsStateStorageServerDescriptor() api.ServerDescriptor

func ResolvedRefappAwsLambdaClientDescriptor

func ResolvedRefappAwsLambdaClientDescriptor() *api.ClientDescriptor

func ResolvedRefappClientDescriptor

func ResolvedRefappClientDescriptor(gitRoot string) *api.ClientDescriptor

func ResolvedRefappCloudClientDescriptor

func ResolvedRefappCloudClientDescriptor(gitRoot string, desc *api.ClientDescriptor) *api.ClientDescriptor

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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