gcp

package module
v0.0.0-...-3efa801 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package gcp is the CONFIG TIER of sc-plugin-gcp.

This package is what SC core imports at parse time — it carries type-token constants, config structs for the YAML operators write, and the init()-time registrations for the parse-time config reader map and the auto-plugin-inject fool-protection.

Published as its OWN Go module (api/go.mod). The plugin binary module (../plugin/go.mod) depends on it; SC core also depends on it. Shipping config + provisioning in one module would make every SC core consumer transitively pull every cloud SDK the plugin uses (pulumi-gcp is ~500 MB in the module cache).

Lifted from in-tree `pkg/clouds/gcloud` of the api repo. Mapping doc: forge/docs/roadmap/items/sc-plugin-gcp-extraction.md. Full walkthrough: api/docs/docs/guides/plugin-authoring.md.

Index

Constants

View Source
const (
	ResourceTypeArtifactRegistry      = "gcp-artifact-registry"
	ResourceTypeRemoteDockerImagePush = "gcp-docker-image-push"
)
View Source
const (
	AuthTypeGCPServiceAccount    = "gcp-service-account"
	SecretsTypeGCPSecretsManager = "gcp-secrets-manager"

	StateStorageTypeGcpBucket = "gcp-bucket"
	SecretsProviderTypeGcpKms = "gcp-kms"
)
View Source
const (
	// DefaultKeyRotationPeriod is applied when keyRotationPeriod is unset.
	//
	// Cloud KMS bills every ACTIVE key version (ENABLED, DISABLED and
	// DESTROY_SCHEDULED all count; only DESTROYED is free) and rotation never
	// re-encrypts existing ciphertext, so every version a key mints stays
	// load-bearing and billed for the lifetime of the key. That makes the
	// rotation period a direct, compounding cost multiplier: one provisioned
	// key per stack rotating daily adds a billed version per stack per day,
	// forever.
	DefaultKeyRotationPeriod = "7776000s" // 90 days

	// MinKeyRotationPeriodSeconds is the lower bound accepted for an explicit
	// keyRotationPeriod. GCP's own floor is 86400s (1 day), which is far too
	// low to be a sane default for a per-stack provisioned key: a period of a
	// few hours or days passes GCP validation and silently accrues versions.
	// Rejecting anything under 30 days turns that class of typo into a
	// config-parse error instead of an unattributed bill months later.
	MinKeyRotationPeriodSeconds = 2592000 // 30 days

	// GCP's own documented bounds for rotationPeriod: at least 24h, at most
	// 876,000h. These are NOT waivable by AllowShortKeyRotation — a value
	// outside them is rejected by the KMS API, and by then the KeyRing has
	// already been created and can never be deleted. Failing here keeps that
	// class of error away from any side effect.
	GcpMinKeyRotationPeriodSeconds = 86400      // 24h
	GcpMaxKeyRotationPeriodSeconds = 3153600000 // 876,000h
)
View Source
const (
	// ResourceTypeGkeAutopilot is the discriminator for the GKE Autopilot
	// cluster resource — a parent-stack-owned cluster that one or more
	// client stacks target via the gcp-gke-autopilot template.
	ResourceTypeGkeAutopilot = "gcp-gke-autopilot-cluster"

	// TemplateTypeGkeAutopilot is the discriminator for the GKE Autopilot
	// compose-style template (Deployment + Service + Ingress + TLS + Caddy
	// override-header rules).
	TemplateTypeGkeAutopilot = "gcp-gke-autopilot"
)
View Source
const (
	DefaultMinPortsPerVm = 64
	DefaultMaxPortsPerVm = 65536
	PortsPerVmFloor      = 32
	PortsPerVmCeiling    = 65536
)

Cloud NAT port-allocation defaults and bounds. Defaults preserve prior behaviour; the floor/ceiling match GCP's accepted range for ports per VM.

View Source
const DefaultNoncurrentVersionRetentionDays = 30

DefaultNoncurrentVersionRetentionDays is the rollback horizon applied when noncurrentVersionRetentionDays is unset. Long enough to recover from a bad deployment, short enough that the dependency set stays bounded.

View Source
const ProviderType = "gcp"

ProviderType is the top-level discriminator every gcp config reports from ProviderType(). Preserved as "gcp" for byte-identical URN continuity with the in-tree driver (playbook §trap-9).

View Source
const ResourceTypeBucket = "gcp-bucket"
View Source
const ResourceTypePostgresGcpCloudsql = "gcp-cloudsql-postgres"
View Source
const ResourceTypePubSub = "gcp-pubsub"
View Source
const ResourceTypeRedis = "gcp-redis"
View Source
const TemplateTypeGcpCloudrun = "cloudrun"

TemplateTypeGcpCloudrun is the parent-template discriminator for the GCP Cloud Run compose-style template.

View Source
const TemplateTypeStaticWebsite = "gcp-static-website"

TemplateTypeStaticWebsite is the template discriminator for a GCS- backed static website. Preserved as "gcp-static-website" for byte-identical URN continuity across the plugin split.

Variables

This section is empty.

Functions

func ArtifactRegistryConfigReadConfig

func ArtifactRegistryConfigReadConfig(config *api.Config) (api.Config, error)

func DockerRemoteImagePushReadConfig

func DockerRemoteImagePushReadConfig(config *api.Config) (api.Config, error)

func GcpBucketReadConfig

func GcpBucketReadConfig(config *api.Config) (api.Config, error)

func GcpPubSubTopicsReadConfig

func GcpPubSubTopicsReadConfig(config *api.Config) (api.Config, error)

func PostgresqlGcpCloudsqlReadConfig

func PostgresqlGcpCloudsqlReadConfig(config *api.Config) (api.Config, error)

func ReadAuthServiceAccountConfig

func ReadAuthServiceAccountConfig(config *api.Config) (api.Config, error)

func ReadCloudRunTemplateConfig

func ReadCloudRunTemplateConfig(config *api.Config) (api.Config, error)

ReadCloudRunTemplateConfig is the parse-time reader registered for `TemplateTypeGcpCloudrun`. Replaces the shared `ReadTemplateConfig` that the stub-era lift used; this one decodes the extra fields.

func ReadGkeAutopilotResourceConfig

func ReadGkeAutopilotResourceConfig(config *api.Config) (api.Config, error)

func ReadGkeAutopilotTemplateConfig

func ReadGkeAutopilotTemplateConfig(config *api.Config) (api.Config, error)

func ReadSecretsProviderConfig

func ReadSecretsProviderConfig(config *api.Config) (api.Config, error)

func ReadStateStorageConfig

func ReadStateStorageConfig(config *api.Config) (api.Config, error)

func ReadTemplateConfig

func ReadTemplateConfig(config *api.Config) (api.Config, error)

ReadTemplateConfig is the parse-time reader registered against every `type:` discriminator shared by GCP template types. It turns the raw `api.Config` the YAML decoder leaves behind into the typed `*TemplateConfig` downstream converters expect.

func RedisReadConfig

func RedisReadConfig(config *api.Config) (api.Config, error)

func ToCloudRunConfig

func ToCloudRunConfig(tpl any, composeCfg compose.Config, stackCfg *api.StackConfigCompose) (any, error)

ToCloudRunConfig is the converter closure the pre-A2 world registered under cloudComposeConverterMapping. Post-A2 the plugin's ConvertStackConfig handler calls it directly after decoding the merged compose config from stackDir. Accepts either the new `*CloudRunTemplate` (preferred) or the legacy `*TemplateConfig` (stub-era) — the legacy path lands with empty `ArtifactRegistryResource` + `Region` and fails loud at Provision-time with a clear sentence.

func ToGkeAutopilotConfig

func ToGkeAutopilotConfig(tpl any, composeCfg compose.Config, stackCfg *api.StackConfigCompose) (any, error)

func ToStaticSiteConfig

func ToStaticSiteConfig(tpl any, stackDir, stackName string, stackCfg *api.StackConfigStatic) (any, error)

ToStaticSiteConfig is the converter closure the pre-A2 world registered under cloudStaticSiteConverterMapping. Post-A2 the plugin's ConvertStackConfig handler calls it directly after decoding stackCfg from the bus. Lifted verbatim from in-tree `pkg/clouds/gcloud/static_website.go`.

func UsesAmbientCredentials

func UsesAmbientCredentials(credentials string) bool

UsesAmbientCredentials reports whether a credentials value means "use ADC".

Types

type AlertsConfig

type AlertsConfig struct {
	MaxErrors MaxErrorConfig
	Discord   DiscordCfg
	Telegram  TelegramCfg
}

AlertsConfig holds the alerting knobs a Cloud Run deployment exposes. Carried from in-tree verbatim — no plugin consumes or validates these yet, but they shape the parent YAML operators already have on disk.

type ArtifactRegistryCleanupMostRecentVersions

type ArtifactRegistryCleanupMostRecentVersions struct {
	KeepCount           *int     `json:"keepCount,omitempty" yaml:"keepCount,omitempty"`
	PackageNamePrefixes []string `json:"packageNamePrefixes,omitempty" yaml:"packageNamePrefixes,omitempty"`
}

type ArtifactRegistryCleanupPolicy

type ArtifactRegistryCleanupPolicy struct {
	// Name identifies the policy within the repository.
	Name string `json:"name" yaml:"name"`
	// Action is DELETE or KEEP (case-insensitive).
	Action    string                                  `json:"action" yaml:"action"`
	Condition *ArtifactRegistryCleanupPolicyCondition `json:"condition,omitempty" yaml:"condition,omitempty"`
	// MostRecentVersions retains a minimum number of versions. KEEP only.
	MostRecentVersions *ArtifactRegistryCleanupMostRecentVersions `json:"mostRecentVersions,omitempty" yaml:"mostRecentVersions,omitempty"`
}

ArtifactRegistryCleanupPolicy mirrors a single Artifact Registry cleanup policy. Durations are the API's second-suffixed form, e.g. "2592000s".

type ArtifactRegistryCleanupPolicyCondition

type ArtifactRegistryCleanupPolicyCondition struct {
	// TagState is TAGGED, UNTAGGED or ANY.
	TagState string `json:"tagState,omitempty" yaml:"tagState,omitempty"`
	// OlderThan / NewerThan are durations, e.g. "2592000s" for 30 days.
	OlderThan           string   `json:"olderThan,omitempty" yaml:"olderThan,omitempty"`
	NewerThan           string   `json:"newerThan,omitempty" yaml:"newerThan,omitempty"`
	TagPrefixes         []string `json:"tagPrefixes,omitempty" yaml:"tagPrefixes,omitempty"`
	PackageNamePrefixes []string `json:"packageNamePrefixes,omitempty" yaml:"packageNamePrefixes,omitempty"`
	VersionNamePrefixes []string `json:"versionNamePrefixes,omitempty" yaml:"versionNamePrefixes,omitempty"`
}

type ArtifactRegistryConfig

type ArtifactRegistryConfig struct {
	Credentials `json:",inline" yaml:",inline"`
	Location    string             `json:"location" yaml:"location"`
	Public      *bool              `json:"public,omitempty" yaml:"public,omitempty"`
	Docker      *DockerConfig      `json:"docker,omitempty" yaml:"docker,omitempty"`
	Domain      *string            `json:"domain" yaml:"domain"`
	BasicAuth   *RegistryBasicAuth `json:"basicAuth,omitempty" yaml:"basicAuth,omitempty"`

	// CleanupPolicies declares image retention for the repository.
	//
	// The provider treats cleanupPolicies as authoritative (unlike labels, whose
	// schema documents itself as non-authoritative), so a repository resource
	// that does not declare it will CLEAR any policy set by another tool on the
	// next provision. Leaving this empty therefore means "SC does not manage
	// retention", and SC preserves whatever is configured out of band rather
	// than deleting it. See ManagesCleanupPolicies.
	// A POINTER so that "absent" and "declared empty" stay distinguishable.
	// The placeholder resolver deep-copies configs by reflection and calls
	// reflect.MakeSlice for every slice kind, so a nil SLICE arrives as an empty
	// one and the difference is destroyed; its pointer branch returns early on
	// nil, so a nil POINTER survives. Without that, `cleanupPolicies: []` could
	// not mean "managed, and I want none", and removing policies from config
	// would silently leave the live ones in place forever.
	CleanupPolicies *[]ArtifactRegistryCleanupPolicy `json:"cleanupPolicies,omitempty" yaml:"cleanupPolicies,omitempty"`

	// CleanupPolicyDryRun evaluates the policies and reports what they would
	// delete without deleting it. Only meaningful alongside CleanupPolicies.
	CleanupPolicyDryRun *bool `json:"cleanupPolicyDryRun,omitempty" yaml:"cleanupPolicyDryRun,omitempty"`
}

func (*ArtifactRegistryConfig) DeclaredCleanupPolicies

func (c *ArtifactRegistryConfig) DeclaredCleanupPolicies() []ArtifactRegistryCleanupPolicy

DeclaredCleanupPolicies returns the declared retention, or nil when SC does not manage it. An explicitly empty list is "managed, and empty", which is how retention is removed.

func (*ArtifactRegistryConfig) ManagesCleanupPolicies

func (c *ArtifactRegistryConfig) ManagesCleanupPolicies() bool

ManagesCleanupPolicies reports whether retention is declared here. When it is not, the caller must tell Pulumi to ignore the field rather than send an empty value, which is the difference between "not managed" and "delete the policy".

type AuthorizedNetwork

type AuthorizedNetwork struct {
	Name string `json:"name,omitempty" yaml:"name,omitempty"`
	Cidr string `json:"cidr" yaml:"cidr"`
}

AuthorizedNetwork is one CIDR allowed to reach the control plane IP endpoint.

type CloudRunInput

type CloudRunInput struct {
	CloudRunTemplate `json:"templateConfig" yaml:"templateConfig"`
	Deployment       k8s.DeploymentConfig `json:"deployment" yaml:"deployment"`
}

CloudRunInput is the typed Input SC core's PrepareCloudComposeForDeploy path (now the plugin's ConvertStackConfig handler) produces for a `type: cloudrun` client stack.

func (*CloudRunInput) DependsOnResources

func (i *CloudRunInput) DependsOnResources() []api.StackConfigDependencyResource

DependsOnResources satisfies api.WithDependsOnResources so SC core's deploy wrapper can resolve cross-resource dependencies ahead of template Provision.

func (*CloudRunInput) OverriddenBaseZone

func (i *CloudRunInput) OverriddenBaseZone() string

OverriddenBaseZone satisfies api.DnsConfigAware — the parent stack's base DNS zone is overridable at the template level.

func (*CloudRunInput) Uses

func (i *CloudRunInput) Uses() []string

Uses satisfies api.ResourceAware — SC core's deploy wrapper reads the list to resolve cross-stack dependencies before dispatching Provision.

type CloudRunTemplate

type CloudRunTemplate struct {
	TemplateConfig           `json:",inline" yaml:",inline"`
	ArtifactRegistryResource string `json:"artifactRegistryResource,omitempty" yaml:"artifactRegistryResource,omitempty"`
	Region                   string `json:"region,omitempty" yaml:"region,omitempty"`
}

CloudRunTemplate is the template config for `type: cloudrun`. Extends the base `TemplateConfig` (Credentials) with:

  • `ArtifactRegistryResource` — name of a parent-stack `gcp-artifact-registry` resource. Images from the client stack's docker-compose are built and pushed there before the Cloud Run service references them. Required: Cloud Run pulls images from GAR, not from arbitrary registries.
  • `Region` — Cloud Run deployment region (e.g. `us-central1`). Required: Cloud Run is a regional resource.

Operators who used the stub body of this template (phase 4e lift from in-tree) will find the stub never declared either field; they are new to this slice and the Provision body now requires both. Operators who never went past the stub have no state to carry forward.

type ControlPlaneAccessConfig

type ControlPlaneAccessConfig struct {
	// DnsEndpoint opens the DNS-based control plane endpoint to callers outside
	// the cluster VPC. The endpoint itself always exists; this is the flag that
	// makes it usable, and it stays authorised by IAM either way.
	DnsEndpoint *bool `json:"dnsEndpoint,omitempty" yaml:"dnsEndpoint,omitempty"`

	// IpEndpoint toggles the IP-based endpoint. Defaults to enabled.
	IpEndpoint *bool `json:"ipEndpoint,omitempty" yaml:"ipEndpoint,omitempty"`

	// AuthorizedNetworks lists the CIDRs allowed to reach the IP endpoint.
	// Setting this field is what turns the allow list on: with the list on and
	// no entries, only Google internal traffic reaches the IP endpoint.
	AuthorizedNetworks []AuthorizedNetwork `json:"authorizedNetworks,omitempty" yaml:"authorizedNetworks,omitempty"`

	// AllowGcpPublicCidrs keeps every Google Cloud public address authorised.
	// GKE defaults this to true, which admits any Google Cloud tenant, so it
	// defaults to false here whenever an allow list is configured.
	AllowGcpPublicCidrs *bool `json:"allowGcpPublicCidrs,omitempty" yaml:"allowGcpPublicCidrs,omitempty"`
}

ControlPlaneAccessConfig configures reachability of the cluster control plane. The two endpoints are independent: the IP endpoint is authorised by source address, the DNS endpoint by IAM. Enabling the DNS endpoint is what makes locking the IP endpoint practical for callers with no stable address, such as hosted CI runners.

func (*ControlPlaneAccessConfig) AuthorizedNetworksEnabled

func (c *ControlPlaneAccessConfig) AuthorizedNetworksEnabled() bool

AuthorizedNetworksEnabled reports whether the IP endpoint allow list applies.

An explicitly empty list is a request to authorise nobody, so it counts as enabled. Only an absent list means "no opinion": read the other way round, `authorizedNetworks: []` would drop the whole block and leave the control plane on GKE's default, which is reachable from anywhere. That is a config that reads as a lock-down and silently is not one, so nil is the only value that turns the allow list off.

func (*ControlPlaneAccessConfig) DnsEndpointEnabled

func (c *ControlPlaneAccessConfig) DnsEndpointEnabled() bool

DnsEndpointEnabled reports whether the DNS endpoint accepts external callers.

func (*ControlPlaneAccessConfig) GcpPublicCidrsAllowed

func (c *ControlPlaneAccessConfig) GcpPublicCidrsAllowed() bool

GcpPublicCidrsAllowed reports the effective value of the Google Cloud public range exemption.

func (*ControlPlaneAccessConfig) IpEndpointEnabled

func (c *ControlPlaneAccessConfig) IpEndpointEnabled() bool

IpEndpointEnabled reports whether the IP endpoint is switched on. It is on unless explicitly disabled, matching GKE.

func (*ControlPlaneAccessConfig) Validate

func (c *ControlPlaneAccessConfig) Validate() error

type Credentials

type Credentials struct {
	api.Credentials      `json:",inline" yaml:",inline"`
	ServiceAccountConfig `json:",inline" yaml:",inline"`
}

func (*Credentials) CredentialsParsed

func (r *Credentials) CredentialsParsed() (*CredentialsParsed, error)

func (*Credentials) CredentialsValue

func (r *Credentials) CredentialsValue() string

func (*Credentials) ProjectIdValue

func (r *Credentials) ProjectIdValue() string

func (*Credentials) ProviderType

func (r *Credentials) ProviderType() string

func (*Credentials) UsesAmbientCredentials

func (r *Credentials) UsesAmbientCredentials() bool

UsesAmbientCredentials reports whether no service-account key is configured, in which case every GCP client uses Application Default Credentials: whatever the environment provides, such as a GitHub OIDC token exchanged through Workload Identity Federation. An empty value used to fail at the first API call, so no working configuration changes meaning.

type CredentialsParsed

type CredentialsParsed struct {
	Type        string `json:"type"`
	ClientEmail string `json:"client_email"`
}

type DiscordCfg

type DiscordCfg struct {
	WebhookId string
}

type DockerConfig

type DockerConfig struct {
	ImmutableTags *bool `json:"immutableTags" yaml:"immutableTags"`
}

type ExternalEgressIpConfig

type ExternalEgressIpConfig struct {
	Enabled  bool   `json:"enabled" yaml:"enabled"`
	Existing string `json:"existing,omitempty" yaml:"existing,omitempty"`

	// Cloud NAT port/mapping tuning. All optional; when unset the previous
	// defaults are preserved (64 min ports, endpoint-independent mapping on,
	// dynamic port allocation off), so existing clusters are unaffected until
	// they opt in. Raising the port budget and enabling dynamic port
	// allocation avoids source-port exhaustion for pods that open many
	// concurrent outbound connections (dropped SYNs surface downstream as
	// dial i/o timeouts).
	MinPortsPerVm *int `json:"minPortsPerVm,omitempty" yaml:"minPortsPerVm,omitempty"`
	MaxPortsPerVm *int `json:"maxPortsPerVm,omitempty" yaml:"maxPortsPerVm,omitempty"`
	// DynamicPortAllocation lets a VM scale its NAT ports between min and max
	// on demand. GCP requires endpoint-independent mapping to be off when it is
	// enabled, and both port bounds to be powers of two.
	DynamicPortAllocation *bool `json:"dynamicPortAllocation,omitempty" yaml:"dynamicPortAllocation,omitempty"`
	// EndpointIndependentMapping toggles NAT EIM (default true). Must be false
	// to use dynamic port allocation.
	EndpointIndependentMapping *bool `json:"endpointIndependentMapping,omitempty" yaml:"endpointIndependentMapping,omitempty"`
}

ExternalEgressIpConfig provides simple configuration for static egress IP

func (*ExternalEgressIpConfig) Validate

func (c *ExternalEgressIpConfig) Validate() error

Validate validates the ExternalEgressIpConfig

type GcpBucket

type GcpBucket struct {
	Credentials `json:",inline" yaml:",inline"`
	Name        string `json:"name,omitempty" yaml:"name"`
	Location    string `json:"location" yaml:"location"`
	// Resource adoption fields
	Adopt      bool   `json:"adopt,omitempty" yaml:"adopt,omitempty"`
	BucketName string `json:"bucketName,omitempty" yaml:"bucketName,omitempty"`
}

func (*GcpBucket) GetBucketName

func (b *GcpBucket) GetBucketName() string

GetBucketName returns the bucket name, supporting both "name" and "bucketName" fields Falls back to "name" if "bucketName" is empty, or "bucketName" if "name" is empty

type GkeAutopilotInput

type GkeAutopilotInput struct {
	GkeAutopilotTemplate `json:"templateConfig" yaml:"templateConfig"`
	Deployment           k8s.DeploymentConfig `json:"deployment" yaml:"deployment"`
}

func (*GkeAutopilotInput) DependsOnResources

func (i *GkeAutopilotInput) DependsOnResources() []api.StackConfigDependencyResource

func (*GkeAutopilotInput) OverriddenBaseZone

func (i *GkeAutopilotInput) OverriddenBaseZone() string

func (*GkeAutopilotInput) Uses

func (i *GkeAutopilotInput) Uses() []string

type GkeAutopilotResource

type GkeAutopilotResource struct {
	Credentials   `json:",inline" yaml:",inline"`
	GkeMinVersion string           `json:"gkeMinVersion" yaml:"gkeMinVersion"`
	Location      string           `json:"location" yaml:"location"`
	Zone          string           `json:"zone" yaml:"zone"`
	Timeouts      *Timeouts        `json:"timeouts,omitempty" yaml:"timeouts,omitempty"`
	Caddy         *k8s.CaddyConfig `json:"caddy,omitempty" yaml:"caddy,omitempty"`

	// External Egress IP Configuration
	ExternalEgressIp *ExternalEgressIpConfig `json:"externalEgressIp,omitempty" yaml:"externalEgressIp,omitempty"`

	// Private VPC - creates dedicated VPC for the cluster (avoids CloudNAT conflicts)
	PrivateVpc bool `json:"privateVpc,omitempty" yaml:"privateVpc,omitempty"`

	// ControlPlaneAccess restricts who may reach the Kubernetes API server.
	// Left unset the control plane keeps GKE's default, an IP endpoint that
	// accepts connections from any address on the internet.
	ControlPlaneAccess *ControlPlaneAccessConfig `json:"controlPlaneAccess,omitempty" yaml:"controlPlaneAccess,omitempty"`

	// Resource adoption fields
	Adopt       bool   `json:"adopt,omitempty" yaml:"adopt,omitempty"`
	ClusterName string `json:"clusterName,omitempty" yaml:"clusterName,omitempty"`

	// DeletionProtection is the cluster's deletion-protection flag,
	// which Pulumi/GKE default to true — a production-safe default that
	// makes `sc destroy` impossible without first flipping the field.
	// Explicit `deletionProtection: false` opts into a smoke-friendly
	// shape (destroy works end-to-end). Nil leaves the Pulumi default
	// (true) in place. See forge/docs/roadmap/items/
	// sc-plugin-gcp-gke-deletion-protection-no-config.md.
	DeletionProtection *bool `json:"deletionProtection,omitempty" yaml:"deletionProtection,omitempty"`
}

type GkeAutopilotTemplate

type GkeAutopilotTemplate struct {
	Credentials              `json:",inline" yaml:",inline"`
	GkeClusterResource       string `json:"gkeClusterResource" yaml:"gkeClusterResource"`
	ArtifactRegistryResource string `json:"artifactRegistryResource" yaml:"artifactRegistryResource"`
}

type MaxErrorConfig

type MaxErrorConfig struct {
	ErrorLogMessageRegexp string
	MaxErrorCount         int
}

type PlainLabels

type PlainLabels map[string]string

type PostgresGcpCloudsqlConfig

type PostgresGcpCloudsqlConfig struct {
	Credentials `json:",inline" yaml:",inline"`
	Version     string  `json:"version" yaml:"version"`
	Project     string  `json:"project" yaml:"project"`
	Tier        *string `json:"tier" yaml:"tier"`
	Region      *string `json:"region" yaml:"region"`
	// Deprecated: prefer DatabaseFlags["max_connections"]; kept for
	// backward compatibility.
	MaxConnections *int `json:"maxConnections" yaml:"maxConnections"`
	// DatabaseFlags sets arbitrary Cloud SQL database flags by name
	// (e.g. cloudsql.iam_authentication: "on"). An explicit max_connections
	// entry here takes precedence over MaxConnections.
	DatabaseFlags         map[string]string       `json:"databaseFlags,omitempty" yaml:"databaseFlags,omitempty"`
	DeletionProtection    *bool                   `json:"deletionProtection" yaml:"deletionProtection"`
	QueryInsightsEnabled  *bool                   `json:"queryInsightsEnabled" yaml:"queryInsightsEnabled"`
	QueryStringLength     *int                    `json:"queryStringLength" yaml:"queryStringLength"`
	UsersProvisionRuntime *ProvisionRuntimeConfig `json:"usersProvisionRuntime" yaml:"usersProvisionRuntime"`
	// Backup configuration
	BackupEnabled               *bool   `json:"backupEnabled,omitempty" yaml:"backupEnabled,omitempty"`
	BackupStartTime             *string `json:"backupStartTime,omitempty" yaml:"backupStartTime,omitempty"`
	PointInTimeRecoveryEnabled  *bool   `json:"pointInTimeRecoveryEnabled,omitempty" yaml:"pointInTimeRecoveryEnabled,omitempty"`
	TransactionLogRetentionDays *int    `json:"transactionLogRetentionDays,omitempty" yaml:"transactionLogRetentionDays,omitempty"`
	RetainedBackups             *int    `json:"retainedBackups,omitempty" yaml:"retainedBackups,omitempty"`
	// High availability
	AvailabilityType *string `json:"availabilityType,omitempty" yaml:"availabilityType,omitempty"` // ZONAL or REGIONAL
	// SSL
	RequireSsl *bool `json:"requireSsl,omitempty" yaml:"requireSsl,omitempty"`
	// PrivateNetwork: when set to a VPC network resource path
	// (projects/{project}/global/networks/{vpc}) the instance is given a
	// private IP on that network. Requires Private Services Access (a
	// servicenetworking peering range) on the VPC: set privateServicesAccessRange
	// for SC to create it, or create it outside SC. Adding it
	// while the public IP stays on is a no-cutover step: the instance gains a
	// private IP but the in-cluster proxy keeps using the public endpoint until
	// proxyPrivateIp is set or publicIpEnabled is set false (see
	// UsesPrivateIpProxy).
	PrivateNetwork *string `json:"privateNetwork,omitempty" yaml:"privateNetwork,omitempty"`
	// PublicIpEnabled toggles the instance's public IPv4 address (default true
	// to preserve existing authorized networks). Setting it false requires
	// privateNetwork and switches the in-cluster cloud-sql-proxy to dial the
	// private IP (--private-ip). Do this only once the private path is verified
	// reachable, since the proxy has no public fallback.
	PublicIpEnabled *bool `json:"publicIpEnabled,omitempty" yaml:"publicIpEnabled,omitempty"`
	// ProxyPrivateIp switches the in-cluster cloud-sql-proxy to the private IP
	// (--private-ip) while the public IP stays on. Requires privateNetwork. Each
	// client stack picks it up on its next deploy and every proxy not yet
	// redeployed keeps the public path, so moving a fleet needs no cutover.
	// Disabling the public IP (publicIpEnabled: false) implies it.
	ProxyPrivateIp *bool `json:"proxyPrivateIp,omitempty" yaml:"proxyPrivateIp,omitempty"`
	// PrivateServicesAccessRange is a CIDR (e.g. 10.30.0.0/20) that SC reserves
	// on privateNetwork and peers to servicenetworking.googleapis.com before
	// creating the instance. Leave it unset when Private Services Access already
	// exists on the VPC. The peering is one per VPC, so set it on at most one
	// resource per network. Treat it as immutable: the range and peering are
	// retained when the field is removed or the stack destroyed, and changing it
	// does not move an existing peering.
	PrivateServicesAccessRange *string `json:"privateServicesAccessRange,omitempty" yaml:"privateServicesAccessRange,omitempty"`
	// Resource adoption fields
	Adopt          bool   `json:"adopt,omitempty" yaml:"adopt,omitempty"`
	InstanceName   string `json:"instanceName,omitempty" yaml:"instanceName,omitempty"`
	ConnectionName string `json:"connectionName,omitempty" yaml:"connectionName,omitempty"`
	RootPassword   string `json:"rootPassword,omitempty" yaml:"rootPassword,omitempty"`
}

func (*PostgresGcpCloudsqlConfig) HasPrivateNetwork

func (c *PostgresGcpCloudsqlConfig) HasPrivateNetwork() bool

HasPrivateNetwork reports whether a non-empty private VPC network is configured.

func (*PostgresGcpCloudsqlConfig) HasPrivateServicesAccessRange

func (c *PostgresGcpCloudsqlConfig) HasPrivateServicesAccessRange() bool

HasPrivateServicesAccessRange reports whether SC should create Private Services Access on privateNetwork.

func (*PostgresGcpCloudsqlConfig) PrivateServicesAccessPrefix

func (c *PostgresGcpCloudsqlConfig) PrivateServicesAccessPrefix() (*net.IPNet, error)

PrivateServicesAccessPrefix parses PrivateServicesAccessRange. The range must be an RFC 1918 IPv4 network address no smaller than /24, which is the least Cloud SQL needs per region.

func (*PostgresGcpCloudsqlConfig) UsesPrivateIpProxy

func (c *PostgresGcpCloudsqlConfig) UsesPrivateIpProxy() bool

UsesPrivateIpProxy reports whether the in-cluster cloud-sql-proxy should dial the instance's private IP: when proxyPrivateIp is set, or when the public IP is disabled and private is the only path. Adding privateNetwork alone does not touch the proxy.

func (*PostgresGcpCloudsqlConfig) Validate

func (c *PostgresGcpCloudsqlConfig) Validate() error

Validate checks Cloud SQL config invariants that would otherwise surface as opaque failures at the GCP API.

type ProvisionRuntimeConfig

type ProvisionRuntimeConfig struct {
	Type         string `json:"type" yaml:"type"`                 // type of provisioning runtime
	ResourceName string `json:"resourceName" yaml:"resourceName"` // allows to run init db users jobs on kube jobs (must reference resource name where we can obtain kubeconfig from, e.g. gke-autopilot-cluster)
}

type PubSubConfig

type PubSubConfig struct {
	Credentials   `json:",inline" yaml:",inline"`
	Topics        []PubSubTopic        `json:"topics" yaml:"topics"`
	Subscriptions []PubSubSubscription `json:"subscriptions" yaml:"subscriptions"`
	Labels        PlainLabels          `json:"labels" yaml:"labels"`
}

type PubSubSubscription

type PubSubSubscription struct {
	Name                     string                            `json:"name" yaml:"name"`
	Topic                    string                            `json:"topic" yaml:"topic"`
	Labels                   PlainLabels                       `json:"labels" yaml:"labels"`
	DeadLetterPolicy         *SubscriptionDeadLetterPolicyArgs `json:"deadLetterPolicy" yaml:"deadLetterPolicy"`
	ExactlyOnceDelivery      bool                              `json:"exactlyOnceDelivery" yaml:"exactlyOnceDelivery"`
	AckDeadlineSec           int                               `json:"ackDeadlineSec" yaml:"ackDeadlineSec"`
	MessageRetentionDuration string                            `json:"messageRetentionDuration" yaml:"messageRetentionDuration"`
}

type PubSubTopic

type PubSubTopic struct {
	Name                     string      `json:"name" yaml:"name"`
	Labels                   PlainLabels `json:"labels" yaml:"labels"`
	MessageRetentionDuration string      `json:"messageRetentionDuration" yaml:"messageRetentionDuration"`
}

type RedisConfig

type RedisConfig struct {
	Credentials  `json:",inline" yaml:",inline"`
	Version      string            `json:"version" yaml:"version"`
	Project      string            `json:"project" yaml:"project"`
	MemorySizeGb int               `json:"memorySizeGb" yaml:"memorySizeGb"`
	RedisConfig  map[string]string `json:"redisConfig" yaml:"redisConfig"`
	Region       *string           `json:"region" yaml:"region"`

	// VPC Network Configuration
	AuthorizedNetwork *string `json:"authorizedNetwork,omitempty" yaml:"authorizedNetwork,omitempty"` // VPC network for Redis connectivity

	// Resource adoption fields
	Adopt      bool   `json:"adopt,omitempty" yaml:"adopt,omitempty"`
	InstanceId string `json:"instanceId,omitempty" yaml:"instanceId,omitempty"`
}

type RegistryBasicAuth

type RegistryBasicAuth struct {
	Username string `json:"username" yaml:"username"`
	Password string `json:"password" yaml:"password"`
}

type RemoteImagePush

type RemoteImagePush struct {
	Credentials              `json:",inline" yaml:",inline"`
	RemoteImage              string            `json:"remoteImage" yaml:"remoteImage"`
	Name                     string            `json:"name" yaml:"name"`
	Tag                      string            `json:"tag" yaml:"tag"`
	ArtifactRegistryResource string            `json:"artifactRegistryResource" yaml:"artifactRegistryResource"`
	RegistryCredentials      *string           `json:"registryCredentials" yaml:"registryCredentials"` // TODO: support other registries' creds
	Platform                 api.ImagePlatform `json:"platform" yaml:"platform"`
}

func (*RemoteImagePush) DependsOnResources

func (i *RemoteImagePush) DependsOnResources() []api.ParentResourceDependency

type SecretsProviderConfig

type SecretsProviderConfig struct {
	Credentials `json:",inline" yaml:",inline"`
	// format:
	// "gcpkms://projects/%s/locations/%s/keyRings/%s/cryptoKeys/%s"
	KeyName string `json:"keyName" yaml:"keyName"`

	// only applicable when provision=true
	KeyLocation string `json:"keyLocation" yaml:"keyLocation"`
	// only applicable when provision=true
	KeyRotationPeriod string `json:"keyRotationPeriod,omitempty" yaml:"keyRotationPeriod,omitempty"`
	// AllowShortKeyRotation opts out of the MinKeyRotationPeriodSeconds floor.
	// Rotating faster than 30 days is a legitimate compliance choice; it is
	// gated only because every rotation mints a permanently billed key version,
	// so the common case of a mistyped period should fail loudly. Setting this
	// makes the short period a deliberate, reviewable decision.
	AllowShortKeyRotation bool `json:"allowShortKeyRotation,omitempty" yaml:"allowShortKeyRotation,omitempty"`

	// whether to provision key
	Provision bool `json:"provision" yaml:"provision"`
}

func (*SecretsProviderConfig) EffectiveKeyRotationPeriod

func (r *SecretsProviderConfig) EffectiveKeyRotationPeriod() string

EffectiveKeyRotationPeriod returns the configured rotation period, or DefaultKeyRotationPeriod when unset.

func (*SecretsProviderConfig) IsProvisionEnabled

func (r *SecretsProviderConfig) IsProvisionEnabled() bool

func (*SecretsProviderConfig) KeyUrl

func (r *SecretsProviderConfig) KeyUrl() string

func (*SecretsProviderConfig) Validate

func (r *SecretsProviderConfig) Validate() error

Validate checks the secrets-provider config. keyRotationPeriod only applies when the key is provisioned here; a BYO key referenced by keyName ignores it, so a stale value must not block those consumers. An empty value is valid and means DefaultKeyRotationPeriod.

type ServiceAccountConfig

type ServiceAccountConfig struct {
	ProjectId string `json:"projectId" yaml:"projectId"`
	// ServiceAccount is the email of the identity the ambient credentials act as.
	// Only read when credentials are empty (see UsesAmbientCredentials), where no
	// key JSON exists to take the email from; resources that grant the deploying
	// identity access to themselves (a static website's write binding) need it.
	ServiceAccount string `json:"serviceAccount,omitempty" yaml:"serviceAccount,omitempty"`
}

type StateStorageConfig

type StateStorageConfig struct {
	Credentials `json:",inline" yaml:",inline"`
	BucketName  string  `json:"bucketName" yaml:"bucketName"`
	Name        string  `json:"name,omitempty" yaml:"name,omitempty"`
	Location    *string `json:"location" yaml:"location"`
	Provision   bool    `json:"provision" yaml:"provision"`

	// NoncurrentVersionRetentionDays bounds how long overwritten state
	// generations are kept when the bucket has object versioning enabled.
	//
	// It matters beyond storage cost. Pulumi's cloud secrets manager re-wraps
	// each stack's data key on every state write, and a KMS symmetric encrypt
	// always uses the key's current primary version, so each retained
	// generation depends on whichever key version was primary when it was
	// written. With versioning on and no lifecycle rule, that set of
	// load-bearing key versions grows without limit and no key version can
	// ever be proven unreferenced.
	//
	// Zero disables the rule. Nil means DefaultNoncurrentVersionRetentionDays.
	NoncurrentVersionRetentionDays *int `json:"noncurrentVersionRetentionDays,omitempty" yaml:"noncurrentVersionRetentionDays,omitempty"`
}

func (*StateStorageConfig) EffectiveNoncurrentVersionRetentionDays

func (s *StateStorageConfig) EffectiveNoncurrentVersionRetentionDays() int

EffectiveNoncurrentVersionRetentionDays resolves the configured retention, falling back to the default when unset. A configured zero disables the rule.

func (*StateStorageConfig) GetBucketName

func (s *StateStorageConfig) GetBucketName() string

GetBucketName returns the bucket name, supporting both "name" and "bucketName" fields Falls back to "name" if "bucketName" is empty, or "bucketName" if "name" is empty

func (*StateStorageConfig) IsProvisionEnabled

func (sa *StateStorageConfig) IsProvisionEnabled() bool

func (*StateStorageConfig) StorageUrl

func (sa *StateStorageConfig) StorageUrl() string

type StaticSiteInput

type StaticSiteInput struct {
	TemplateConfig         `json:"templateConfig" yaml:"templateConfig"`
	*api.StackConfigStatic `json:"-" yaml:"-"`
	StackDir               string `json:"stackDir" yaml:"stackDir"`
	StackName              string `json:"stackName" yaml:"stackName"`

	// Flat scalar fields the plugin body reads. Populated by
	// `ToStaticSiteConfig` from the embedded `*api.StackConfigStatic` so
	// they SURVIVE the plugin-bus JSON+YAML roundtrip. See the asymmetry
	// note on `StackConfigStatic` above the `json:"-" yaml:"-"` tag.
	//
	// Why this exists: `encoding/json` ignores the `,inline` tag (it's a
	// yaml.v3 convention, not a Go stdlib one), so a nested-inline-with-
	// pointer embed — `*api.StackConfigStatic` → inline Site
	// StaticSiteConfig → inline fields — serialises to JSON as a nested
	// object (keyed on the Go field name). On the plugin side yaml.v3's
	// `inline` decoder then expects FLATTENED fields at the top, can't
	// find them, and leaves every Site field zero. The body reading
	// `in.Site.Domain` got "" every time, and the CF plugin's
	// NewDnsRecord / NewOverrideHeaderRule received empty names that CF
	// rejected with `9000 DNS name is invalid` / `10022 Route pattern
	// must include zone name`. Live-caught on #568's preview-publish
	// workflow against `dist.simple-container.com`, 2026-11-08/09.
	//
	// The embed stays on the Go side (methods like `Uses()` on
	// `*StackConfigStatic` are called by SC core via interface assertion,
	// so the ambient fields must stay reachable), but is marked `json:"-"
	// yaml:"-"` so it doesn't get serialised with the broken inline
	// shape. Explicit scalar fields below carry what the plugin body
	// actually reads.
	Domain        string `json:"domain" yaml:"domain"`
	BaseDnsZone   string `json:"baseDnsZone" yaml:"baseDnsZone"`
	IndexDocument string `json:"indexDocument" yaml:"indexDocument"`
	ErrorDocument string `json:"errorDocument" yaml:"errorDocument"`
	BundleDir     string `json:"bundleDir" yaml:"bundleDir"`
	BucketName    string `json:"bucketName" yaml:"bucketName"`
	Location      string `json:"location" yaml:"location"`
}

StaticSiteInput is the typed Input SC core's PrepareStaticForDeploy (now the plugin's ConvertStackConfig handler) produces for a `type: gcp-static-website` client stack. Satisfies api.ResourceAware (via embedded StackConfigStatic.Uses) and api.DnsConfigAware (OverriddenBaseZone).

func (*StaticSiteInput) OverriddenBaseZone

func (i *StaticSiteInput) OverriddenBaseZone() string

OverriddenBaseZone satisfies api.DnsConfigAware. Reads the flat BaseDnsZone field (set by ToStaticSiteConfig), which survives the plugin-bus roundtrip. The embedded Site chain does not — see the struct comment.

type SubscriptionDeadLetterPolicyArgs

type SubscriptionDeadLetterPolicyArgs struct {
	DeadLetterTopic     *string `json:"deadLetterTopic,omitempty" yaml:"deadLetterTopic,omitempty"`
	MaxDeliveryAttempts *int    `json:"maxDeliveryAttempts,omitempty" yaml:"maxDeliveryAttempts,omitempty"`
}

type TelegramCfg

type TelegramCfg struct {
	DefaultChatId string
}

type TemplateConfig

type TemplateConfig struct {
	Credentials `json:",inline" yaml:",inline"`
}

TemplateConfig is the parent-side template config block every GCP plugin template type (cloudrun, gcp-static-website, gcp-gke-autopilot) reads its credentials/project out of. Embeds the GCP-side Credentials (which in turn embeds api.Credentials — the auth block common to providers, parent templates and resources) so a parent descriptor can reuse an auth: block via a YAML anchor without re-declaring keys.

Lifted from api `pkg/clouds/gcloud/gcloud.go`.

type Timeouts

type Timeouts struct {
	Create string `json:"create" yaml:"create"`
	Update string `json:"update" yaml:"update"`
	Delete string `json:"delete" yaml:"delete"`
}

Jump to

Keyboard shortcuts

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