Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions cmd/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ const (
PendingApplyStatusFlag = "pending-apply-status"
StatsNamespace = "stats-namespace"
AllowDraftPRs = "allow-draft-prs"
EnableExternalStoresFlag = "enable-external-stores"
PortFlag = "port"
RedisDB = "redis-db"
RedisHost = "redis-host"
Expand Down Expand Up @@ -581,6 +582,10 @@ var boolFlags = map[string]boolFlag{
description: "Set apply job status as pending when there are planned changes that haven't been applied yet. Currently only supported for GitLab.",
defaultValue: false,
},
EnableExternalStoresFlag: {
description: "Enable external storage backends configured in the server-side repo config (external_stores block).",
defaultValue: false,
},
QuietPolicyChecks: {
description: "Exclude policy check comments from pull requests unless there's an actual error from conftest. This also excludes warnings.",
defaultValue: false,
Expand Down
1 change: 1 addition & 0 deletions cmd/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ var testFlags = map[string]any{
MaxCommentsPerCommand: 10,
StatsNamespace: "atlantis",
AllowDraftPRs: true,
EnableExternalStoresFlag: false,
PortFlag: 8181,
ParallelPoolSize: 100,
ParallelPlanFlag: true,
Expand Down
19 changes: 19 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ require (
code.gitea.io/sdk/gitea v0.23.2
github.com/Masterminds/sprig/v3 v3.3.0
github.com/alicebob/miniredis/v2 v2.36.1
github.com/aws/aws-sdk-go-v2 v1.41.4
github.com/aws/aws-sdk-go-v2/config v1.32.11
github.com/aws/aws-sdk-go-v2/service/s3 v1.96.4
github.com/bmatcuk/doublestar/v4 v4.10.0
github.com/bradleyfalzon/ghinstallation/v2 v2.17.0
github.com/briandowns/spinner v1.23.2
Expand Down Expand Up @@ -74,6 +77,22 @@ require (
github.com/ProtonMail/go-mime v0.0.0-20230322103455-7d82a3887f2f // indirect
github.com/ProtonMail/gopenpgp/v2 v2.7.5 // indirect
github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.7 // indirect
github.com/aws/aws-sdk-go-v2/credentials v1.19.12 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.20 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.20 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.20 // indirect
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.6 // indirect
github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.21 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.7 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.12 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.20 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.20 // indirect
github.com/aws/aws-sdk-go-v2/service/signin v1.0.8 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.30.13 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.17 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.41.9 // indirect
github.com/aws/smithy-go v1.24.2 // indirect
github.com/aymerick/douceur v0.2.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect
Expand Down
38 changes: 38 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,44 @@ github.com/apparentlymart/go-textseg/v15 v15.0.0 h1:uYvfpb3DyLSCGWnctWKGj857c6ew
github.com/apparentlymart/go-textseg/v15 v15.0.0/go.mod h1:K8XmNZdhEBkdlyDdvbmmsvpAG721bKi0joRfFdHIWJ4=
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 h1:DklsrG3dyBCFEj5IhUbnKptjxatkF07cF2ak3yi77so=
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw=
github.com/aws/aws-sdk-go-v2 v1.41.4 h1:10f50G7WyU02T56ox1wWXq+zTX9I1zxG46HYuG1hH/k=
github.com/aws/aws-sdk-go-v2 v1.41.4/go.mod h1:mwsPRE8ceUUpiTgF7QmQIJ7lgsKUPQOUl3o72QBrE1o=
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.7 h1:3kGOqnh1pPeddVa/E37XNTaWJ8W6vrbYV9lJEkCnhuY=
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.7/go.mod h1:lyw7GFp3qENLh7kwzf7iMzAxDn+NzjXEAGjKS2UOKqI=
github.com/aws/aws-sdk-go-v2/config v1.32.11 h1:ftxI5sgz8jZkckuUHXfC/wMUc8u3fG1vQS0plr2F2Zs=
github.com/aws/aws-sdk-go-v2/config v1.32.11/go.mod h1:twF11+6ps9aNRKEDimksp923o44w/Thk9+8YIlzWMmo=
github.com/aws/aws-sdk-go-v2/credentials v1.19.12 h1:oqtA6v+y5fZg//tcTWahyN9PEn5eDU/Wpvc2+kJ4aY8=
github.com/aws/aws-sdk-go-v2/credentials v1.19.12/go.mod h1:U3R1RtSHx6NB0DvEQFGyf/0sbrpJrluENHdPy1j/3TE=
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.20 h1:zOgq3uezl5nznfoK3ODuqbhVg1JzAGDUhXOsU0IDCAo=
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.20/go.mod h1:z/MVwUARehy6GAg/yQ1GO2IMl0k++cu1ohP9zo887wE=
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.20 h1:CNXO7mvgThFGqOFgbNAP2nol2qAWBOGfqR/7tQlvLmc=
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.20/go.mod h1:oydPDJKcfMhgfcgBUZaG+toBbwy8yPWubJXBVERtI4o=
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.20 h1:tN6W/hg+pkM+tf9XDkWUbDEjGLb+raoBMFsTodcoYKw=
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.20/go.mod h1:YJ898MhD067hSHA6xYCx5ts/jEd8BSOLtQDL3iZsvbc=
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.6 h1:qYQ4pzQ2Oz6WpQ8T3HvGHnZydA72MnLuFK9tJwmrbHw=
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.6/go.mod h1:O3h0IK87yXci+kg6flUKzJnWeziQUKciKrLjcatSNcY=
github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.21 h1:SwGMTMLIlvDNyhMteQ6r8IJSBPlRdXX5d4idhIGbkXA=
github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.21/go.mod h1:UUxgWxofmOdAMuqEsSppbDtGKLfR04HGsD0HXzvhI1k=
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.7 h1:5EniKhLZe4xzL7a+fU3C2tfUN4nWIqlLesfrjkuPFTY=
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.7/go.mod h1:x0nZssQ3qZSnIcePWLvcoFisRXJzcTVvYpAAdYX8+GI=
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.12 h1:qtJZ70afD3ISKWnoX3xB0J2otEqu3LqicRcDBqsj0hQ=
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.12/go.mod h1:v2pNpJbRNl4vEUWEh5ytQok0zACAKfdmKS51Hotc3pQ=
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.20 h1:2HvVAIq+YqgGotK6EkMf+KIEqTISmTYh5zLpYyeTo1Y=
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.20/go.mod h1:V4X406Y666khGa8ghKmphma/7C0DAtEQYhkq9z4vpbk=
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.20 h1:siU1A6xjUZ2N8zjTHSXFhB9L/2OY8Dqs0xXiLjF30jA=
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.20/go.mod h1:4TLZCmVJDM3FOu5P5TJP0zOlu9zWgDWU7aUxWbr+rcw=
github.com/aws/aws-sdk-go-v2/service/s3 v1.96.4 h1:4ExZyubQ6LQQVuF2Qp9OsfEvsTdAWh5Gfwf6PgIdLdk=
github.com/aws/aws-sdk-go-v2/service/s3 v1.96.4/go.mod h1:NF3JcMGOiARAss1ld3WGORCw71+4ExDD2cbbdKS5PpA=
github.com/aws/aws-sdk-go-v2/service/signin v1.0.8 h1:0GFOLzEbOyZABS3PhYfBIx2rNBACYcKty+XGkTgw1ow=
github.com/aws/aws-sdk-go-v2/service/signin v1.0.8/go.mod h1:LXypKvk85AROkKhOG6/YEcHFPoX+prKTowKnVdcaIxE=
github.com/aws/aws-sdk-go-v2/service/sso v1.30.13 h1:kiIDLZ005EcKomYYITtfsjn7dtOwHDOFy7IbPXKek2o=
github.com/aws/aws-sdk-go-v2/service/sso v1.30.13/go.mod h1:2h/xGEowcW/g38g06g3KpRWDlT+OTfxxI0o1KqayAB8=
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.17 h1:jzKAXIlhZhJbnYwHbvUQZEB8KfgAEuG0dc08Bkda7NU=
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.17/go.mod h1:Al9fFsXjv4KfbzQHGe6V4NZSZQXecFcvaIF4e70FoRA=
github.com/aws/aws-sdk-go-v2/service/sts v1.41.9 h1:Cng+OOwCHmFljXIxpEVXAGMnBia8MSU6Ch5i9PgBkcU=
github.com/aws/aws-sdk-go-v2/service/sts v1.41.9/go.mod h1:LrlIndBDdjA/EeXeyNBle+gyCwTlizzW5ycgWnvIxkk=
github.com/aws/smithy-go v1.24.2 h1:FzA3bu/nt/vDvmnkg+R8Xl46gmzEDam6mZ1hzmwXFng=
github.com/aws/smithy-go v1.24.2/go.mod h1:YE2RhdIuDbA5E5bTdciG9KrW3+TiEONeUWCqxX9i1Fc=
github.com/aymerick/douceur v0.2.0 h1:Mv+mAeH1Q+n9Fr+oyamOlAkUNPWPlA8PPGR0QAaYuPk=
github.com/aymerick/douceur v0.2.0/go.mod h1:wlT5vV2O3h55X9m7iVYN0TBM0NH/MmbLnd30/FjWUq4=
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
Expand Down
10 changes: 10 additions & 0 deletions runatlantis.io/docs/server-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,16 @@ Enable Atlantis to format Terraform plan output into a markdown-diff friendly fo

Useful to enable for use with GitHub.

### `--enable-external-stores`

```bash
atlantis server --enable-external-stores
# or
ATLANTIS_ENABLE_EXTERNAL_STORES=true
```

Enable external storage backends configured in the server-side repo config (`external_stores` block). When set, Atlantis reads the `external_stores` section from the repo config YAML to initialize backends such as S3 for plan file persistence.

### `--enable-policy-checks` <Badge text="v0.17.0" type="info"/>

```bash
Expand Down
7 changes: 5 additions & 2 deletions server/controllers/events/events_controller_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1471,6 +1471,7 @@ func setupE2E(t *testing.T, repoDir string, opt setupOption) (events_controllers
"auto",
statsScope,
terraformClient,
&runtime.LocalPlanStore{},
)

showStepRunner, err := runtime.NewShowStepRunner(terraformClient, defaultTFDistribution, defaultTFVersion)
Expand Down Expand Up @@ -1508,14 +1509,16 @@ func setupE2E(t *testing.T, repoDir string, opt setupOption) (events_controllers
defaultTFVersion,
statusUpdater,
asyncTfExec,
&runtime.LocalPlanStore{},
),
ShowStepRunner: showStepRunner,
PolicyCheckStepRunner: policyCheckRunner,
ApplyStepRunner: &runtime.ApplyStepRunner{
TerraformExecutor: terraformClient,
PlanStore: &runtime.LocalPlanStore{},
},
ImportStepRunner: runtime.NewImportStepRunner(terraformClient, defaultTFDistribution, defaultTFVersion),
StateRmStepRunner: runtime.NewStateRmStepRunner(terraformClient, defaultTFDistribution, defaultTFVersion),
ImportStepRunner: runtime.NewImportStepRunner(terraformClient, defaultTFDistribution, defaultTFVersion, &runtime.LocalPlanStore{}),
StateRmStepRunner: runtime.NewStateRmStepRunner(terraformClient, defaultTFDistribution, defaultTFVersion, &runtime.LocalPlanStore{}),
RunStepRunner: &runtime.RunStepRunner{
TerraformExecutor: terraformClient,
DefaultTFDistribution: defaultTFDistribution,
Expand Down
83 changes: 73 additions & 10 deletions server/core/config/raw/global_cfg.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,69 @@ import (

// GlobalCfg is the raw schema for server-side repo config.
type GlobalCfg struct {
Repos []Repo `yaml:"repos" json:"repos"`
Workflows map[string]Workflow `yaml:"workflows" json:"workflows"`
PolicySets PolicySets `yaml:"policies" json:"policies"`
Metrics Metrics `yaml:"metrics" json:"metrics"`
TeamAuthz TeamAuthz `yaml:"team_authz" json:"team_authz"`
Repos []Repo `yaml:"repos" json:"repos"`
Workflows map[string]Workflow `yaml:"workflows" json:"workflows"`
PolicySets PolicySets `yaml:"policies" json:"policies"`
Metrics Metrics `yaml:"metrics" json:"metrics"`
TeamAuthz TeamAuthz `yaml:"team_authz" json:"team_authz"`
ExternalStores ExternalStores `yaml:"external_stores" json:"external_stores"`
}

// ExternalStores is the raw schema for external storage backends.
type ExternalStores struct {
PlanStore PlanStoreConfig `yaml:"plan_store" json:"plan_store"`
}

// PlanStoreConfig is the raw schema for plan storage configuration.
type PlanStoreConfig struct {
Type string `yaml:"type" json:"type"`
S3 S3StoreConfig `yaml:"s3" json:"s3"`
}

// S3StoreConfig is the raw schema for S3 plan store configuration.
type S3StoreConfig struct {
Bucket string `yaml:"bucket" json:"bucket"`
Region string `yaml:"region" json:"region"`
Prefix string `yaml:"prefix" json:"prefix"`
Endpoint string `yaml:"endpoint" json:"endpoint"`
ForcePathStyle bool `yaml:"force_path_style" json:"force_path_style"`
Profile string `yaml:"profile" json:"profile"`
}

func (e ExternalStores) Validate() error {
return e.PlanStore.Validate()
}

func (p PlanStoreConfig) Validate() error {
if p.Type == "" {
return nil
}
if p.Type != "s3" {
return fmt.Errorf("unsupported plan store type %q: only 's3' is supported", p.Type)
}
if p.S3.Bucket == "" {
return fmt.Errorf("external_stores.plan_store.s3.bucket is required when type is 's3'")
}
if p.S3.Region == "" {
return fmt.Errorf("external_stores.plan_store.s3.region is required when type is 's3'")
}
return nil
}

func (e ExternalStores) ToValid() valid.ExternalStores {
return valid.ExternalStores{
PlanStore: valid.PlanStoreConfig{
Type: e.PlanStore.Type,
S3: valid.S3StoreConfig{
Bucket: e.PlanStore.S3.Bucket,
Region: e.PlanStore.S3.Region,
Prefix: e.PlanStore.S3.Prefix,
Endpoint: e.PlanStore.S3.Endpoint,
ForcePathStyle: e.PlanStore.S3.ForcePathStyle,
Profile: e.PlanStore.S3.Profile,
},
},
}
}

// Repo is the raw schema for repos in the server-side repo config.
Expand Down Expand Up @@ -56,6 +114,10 @@ func (g GlobalCfg) Validate() error {
return err
}

if err := g.ExternalStores.Validate(); err != nil {
return err
}

// Check that all workflows referenced by repos are actually defined.
for _, repo := range g.Repos {
if repo.Workflow == nil {
Expand Down Expand Up @@ -161,11 +223,12 @@ func (g GlobalCfg) ToValid(defaultCfg valid.GlobalCfg) valid.GlobalCfg {
repos = append(defaultCfg.Repos, repos...)

return valid.GlobalCfg{
Repos: repos,
Workflows: workflows,
PolicySets: g.PolicySets.ToValid(),
Metrics: g.Metrics.ToValid(),
TeamAuthz: g.TeamAuthz.ToValid(),
Repos: repos,
Workflows: workflows,
PolicySets: g.PolicySets.ToValid(),
Metrics: g.Metrics.ToValid(),
TeamAuthz: g.TeamAuthz.ToValid(),
ExternalStores: g.ExternalStores.ToValid(),
}
}

Expand Down
32 changes: 27 additions & 5 deletions server/core/config/valid/global_cfg.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,33 @@ var NonOverridableApplyReqs = []string{PoliciesPassedCommandReq}

// GlobalCfg is the final parsed version of server-side repo config.
type GlobalCfg struct {
Repos []Repo
Workflows map[string]Workflow
PolicySets PolicySets
Metrics Metrics
TeamAuthz TeamAuthz
Repos []Repo
Workflows map[string]Workflow
PolicySets PolicySets
Metrics Metrics
TeamAuthz TeamAuthz
ExternalStores ExternalStores
}

// ExternalStores holds configuration for external storage backends.
type ExternalStores struct {
PlanStore PlanStoreConfig
}

// PlanStoreConfig holds the type and backend-specific config for plan storage.
type PlanStoreConfig struct {
Type string
S3 S3StoreConfig
}

// S3StoreConfig holds S3-specific configuration for the plan store.
type S3StoreConfig struct {
Bucket string
Region string
Prefix string
Endpoint string
ForcePathStyle bool
Profile string
}

type Metrics struct {
Expand Down
7 changes: 5 additions & 2 deletions server/core/runtime/apply_step_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import (
"github.com/runatlantis/atlantis/server/core/terraform"
"github.com/runatlantis/atlantis/server/events/command"
"github.com/runatlantis/atlantis/server/events/models"
"github.com/runatlantis/atlantis/server/utils"
)

// ApplyStepRunner runs `terraform apply`.
Expand All @@ -26,6 +25,7 @@ type ApplyStepRunner struct {
DefaultTFVersion *version.Version `validate:"required"`
CommitStatusUpdater StatusUpdater `validate:"required"`
AsyncTFExec AsyncTFExec `validate:"required"`
PlanStore PlanStore `validate:"required"`
}

func (a *ApplyStepRunner) Run(ctx command.ProjectContext, extraArgs []string, path string, envs map[string]string) (string, error) {
Expand All @@ -34,6 +34,9 @@ func (a *ApplyStepRunner) Run(ctx command.ProjectContext, extraArgs []string, pa
}

planPath := filepath.Join(path, GetPlanFilename(ctx.Workspace, ctx.ProjectName))
if loadErr := a.PlanStore.Load(ctx, planPath); loadErr != nil {
return "", fmt.Errorf("loading plan: %w", loadErr)
}
contents, err := os.ReadFile(planPath)
if os.IsNotExist(err) {
return "", fmt.Errorf("no plan found at path %q and workspace %q–did you run plan?", ctx.RepoRelDir, ctx.Workspace)
Expand Down Expand Up @@ -70,7 +73,7 @@ func (a *ApplyStepRunner) Run(ctx command.ProjectContext, extraArgs []string, pa
// If the apply was successful, delete the plan.
if err == nil {
ctx.Log.Info("apply successful, deleting planfile")
if removeErr := utils.RemoveIgnoreNonExistent(planPath); removeErr != nil {
if removeErr := a.PlanStore.Remove(ctx, planPath); removeErr != nil {
ctx.Log.Warn("failed to delete planfile after successful apply: %s", removeErr)
}
}
Expand Down
9 changes: 9 additions & 0 deletions server/core/runtime/apply_step_runner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import (
func TestRun_NoDir(t *testing.T) {
o := runtime.ApplyStepRunner{
TerraformExecutor: nil,
PlanStore: &runtime.LocalPlanStore{},
}
_, err := o.Run(command.ProjectContext{
RepoRelDir: ".",
Expand All @@ -42,6 +43,7 @@ func TestRun_NoPlanFile(t *testing.T) {
tmpDir := t.TempDir()
o := runtime.ApplyStepRunner{
TerraformExecutor: nil,
PlanStore: &runtime.LocalPlanStore{},
}
_, err := o.Run(command.ProjectContext{
RepoRelDir: ".",
Expand Down Expand Up @@ -70,6 +72,7 @@ func TestRun_Success(t *testing.T) {
o := runtime.ApplyStepRunner{
TerraformExecutor: terraform,
DefaultTFDistribution: tfDistribution,
PlanStore: &runtime.LocalPlanStore{},
}

When(terraform.RunCommandWithVersion(Any[command.ProjectContext](), Any[string](), Any[[]string](), Any[map[string]string](), Any[tf.Distribution](), Any[*version.Version](), Any[string]())).
Expand Down Expand Up @@ -105,6 +108,7 @@ func TestRun_AppliesCorrectProjectPlan(t *testing.T) {
o := runtime.ApplyStepRunner{
TerraformExecutor: terraform,
DefaultTFDistribution: tfDistribution,
PlanStore: &runtime.LocalPlanStore{},
}
When(terraform.RunCommandWithVersion(Any[command.ProjectContext](), Any[string](), Any[[]string](), Any[map[string]string](), Any[tf.Distribution](), Any[*version.Version](), Any[string]())).
ThenReturn("output", nil)
Expand Down Expand Up @@ -139,6 +143,7 @@ func TestApplyStepRunner_TestRun_UsesConfiguredTFVersion(t *testing.T) {
o := runtime.ApplyStepRunner{
TerraformExecutor: terraform,
DefaultTFDistribution: tfDistribution,
PlanStore: &runtime.LocalPlanStore{},
}
When(terraform.RunCommandWithVersion(Any[command.ProjectContext](), Any[string](), Any[[]string](), Any[map[string]string](), Any[tf.Distribution](), Any[*version.Version](), Any[string]())).
ThenReturn("output", nil)
Expand Down Expand Up @@ -175,6 +180,7 @@ func TestApplyStepRunner_TestRun_UsesConfiguredDistribution(t *testing.T) {
TerraformExecutor: terraform,
DefaultTFDistribution: tfDistribution,
DefaultTFVersion: tfVersion,
PlanStore: &runtime.LocalPlanStore{},
}
When(terraform.RunCommandWithVersion(Any[command.ProjectContext](), Any[string](), Any[[]string](), Any[map[string]string](), NotEq[tf.Distribution](tfDistribution), Any[*version.Version](), Any[string]())).
ThenReturn("output", nil)
Expand Down Expand Up @@ -248,6 +254,7 @@ func TestRun_UsingTarget(t *testing.T) {
terraform := tfclientmocks.NewMockClient()
step := runtime.ApplyStepRunner{
TerraformExecutor: terraform,
PlanStore: &runtime.LocalPlanStore{},
}

output, err := step.Run(command.ProjectContext{
Expand Down Expand Up @@ -291,6 +298,7 @@ Plan: 0 to add, 0 to change, 1 to destroy.`
o := runtime.ApplyStepRunner{
AsyncTFExec: tfExec,
CommitStatusUpdater: updater,
PlanStore: &runtime.LocalPlanStore{},
}
tfVersion, _ := version.NewVersion("0.11.0")
ctx := command.ProjectContext{
Expand Down Expand Up @@ -351,6 +359,7 @@ Plan: 0 to add, 0 to change, 1 to destroy.`
o := runtime.ApplyStepRunner{
AsyncTFExec: tfExec,
CommitStatusUpdater: runtimemocks.NewMockStatusUpdater(),
PlanStore: &runtime.LocalPlanStore{},
}
tfVersion, _ := version.NewVersion("0.11.0")

Expand Down
Loading
Loading