sourcegraph/dev/managedservicesplatform/stacks
Robert Lin 6c59b02534
feat/msp: do not use tfvars file outside of deploy-type 'subscription' (#62704)
Closes CORE-121

The dependency on the generated `tfvars` file is frustrating for first-time MSP setup because it currently requires `-stable=false` to update, and doesn't actually serve any purpose for deploy types other than `subscription` (which uses it to isolate image changes that happen on via GitHub actions). This makes it so that we don't generate, or depend on, the dynamic `tfvars` file unless you are using `subscription`.

I've also added a rollout spec configuration, `initialImageTag`, to make the initial tag we provision environments with configurable (as some services might not publish `insiders` images) - see the docstring.

## Test plan

Inspect output of `sg msp generate -all`
2024-05-16 09:43:47 -07:00
..
cloudrun feat/msp: do not use tfvars file outside of deploy-type 'subscription' (#62704) 2024-05-16 09:43:47 -07:00
iam bazel: transcribe test ownership to bazel tags (#62664) 2024-05-16 15:51:16 +01:00
monitoring bazel: transcribe test ownership to bazel tags (#62664) 2024-05-16 15:51:16 +01:00
project bazel: transcribe test ownership to bazel tags (#62664) 2024-05-16 15:51:16 +01:00
tfcworkspaces bazel: transcribe test ownership to bazel tags (#62664) 2024-05-16 15:51:16 +01:00
BUILD.bazel bazel: transcribe test ownership to bazel tags (#62664) 2024-05-16 15:51:16 +01:00
README.md msp: restructure to export stacks implementations (#59345) 2024-01-05 00:56:12 +00:00
stacks.go sg msp: use env GSM only, fix 'sg msp logs' for jobs (#59346) 2024-01-04 18:07:42 -08:00

CDKTF stacks

A stack is a fully composed set of CDKTF resources that maps to a Terraform workspace. A set of stacks composes a CDKTF application.

Each stack package must declare the following interface:

import (
  "github.com/sourcegraph/sourcegraph/dev/managedservicesplatform/internal/stack"
  "github.com/sourcegraph/sourcegraph/dev/managedservicesplatform/internal/stack/options/googleprovider"
)

// CrossStackOutput allows programatic access to stack outputs across stacks.
// For human reference outputs, use (stack.ExplicitStackOutputs).Add(...)
type CrossStackOutput struct {}

type Variables struct {}

const StackName = "..."

func NewStack(stacks *stack.Set, vars Variables) (*CrossStackOutput, error) {
  stack, outputs := stacks.New(StackName,
    googleprovider.With(vars.ProjectID),
    // ... other stack-wide options
  )

  // ...
}