Skip to content
Open
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@
- feat(compute/build): Block version 1.93.0 of Rust to avoid a wasm32-wasip2 bug. ([#1653](https://github.com/fastly/cli/pull/1653))
- feat(service/vcl): escape control characters when displaying VCL content for cleaner terminal output ([#1637](https://github.com/fastly/cli/pull/1637))

- feat(compute/deploy): Apply \[setup.products] for enabling products during initial deploy ([#1617](https://github.com/fastly/cli/pull/1617))

### Dependencies:

- build(deps): `golang.org/x/net` from 0.50.0 to 0.51.0 ([#1674](https://github.com/fastly/cli/pull/1674))
Expand Down
31 changes: 31 additions & 0 deletions pkg/commands/compute/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -817,6 +817,7 @@ type ServiceResources struct {
objectStores *setup.KVStores
kvStores *setup.KVStores
secretStores *setup.SecretStores
products *setup.Products
}

// ConstructNewServiceResources instantiates multiple [setup] config resources for a
Expand Down Expand Up @@ -887,6 +888,17 @@ func (c *DeployCommand) ConstructNewServiceResources(
Stdin: in,
Stdout: out,
}

sr.products = &setup.Products{
APIClient: c.Globals.APIClient,
AcceptDefaults: c.Globals.Flags.AcceptDefaults,
NonInteractive: c.Globals.Flags.NonInteractive,
ServiceID: serviceID,
ServiceVersion: serviceVersion,
Setup: c.Globals.Manifest.File.Setup.Products,
Stdin: in,
Stdout: out,
}
}

// ConfigureServiceResources calls the .Predefined() and .Configure() methods
Expand Down Expand Up @@ -941,6 +953,13 @@ func (c *DeployCommand) ConfigureServiceResources(sr ServiceResources, serviceID
}
}

if sr.products.Predefined() {
if err := sr.products.Configure(); err != nil {
errLogService(c.Globals.ErrLog, err, serviceID, serviceVersion)
return fmt.Errorf("error configuring service products: %w", err)
}
}

return nil
}

Expand All @@ -957,6 +976,7 @@ func (c *DeployCommand) CreateServiceResources(
sr.objectStores.Spinner = spinner
sr.kvStores.Spinner = spinner
sr.secretStores.Spinner = spinner
sr.products.Spinner = spinner

if err := sr.backends.Create(); err != nil {
c.Globals.ErrLog.AddWithContext(err, map[string]any{
Expand Down Expand Up @@ -1013,6 +1033,17 @@ func (c *DeployCommand) CreateServiceResources(
return err
}

if err := sr.products.Create(); err != nil {
c.Globals.ErrLog.AddWithContext(err, map[string]any{
"Accept defaults": c.Globals.Flags.AcceptDefaults,
"Auto-yes": c.Globals.Flags.AutoYes,
"Non-interactive": c.Globals.Flags.NonInteractive,
"Service ID": serviceID,
"Service Version": serviceVersion,
})
return err
}

return nil
}

Expand Down
Loading
Loading