Skip to content

Commit

Permalink
breaking(product_enablement): Remove support for NGWAF product.
Browse files Browse the repository at this point in the history
The support added for the NGWAF product in version 5.14.0 did not
work, and is being removed so that it can be redesigned. Since the
feature was non-operational, no users of the provider could have
relied on it, so the major version number is not being incremented in
spite of the breaking nature of the change.
  • Loading branch information
kpfleming committed Nov 7, 2024
1 parent de01fe6 commit d2dd941
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 59 deletions.
58 changes: 0 additions & 58 deletions fastly/block_fastly_service_product_enablement.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,6 @@ func (h *ProductEnablementServiceAttributeHandler) GetSchema() *schema.Schema {
Optional: true,
Description: "Enable Image Optimizer support (all backends must have a `shield` attribute)",
}
blockAttributes["ngwaf"] = &schema.Schema{
Type: schema.TypeBool,
Optional: true,
Description: "Enable Next-Gen WAF support",
}
blockAttributes["origin_inspector"] = &schema.Schema{
Type: schema.TypeBool,
Optional: true,
Expand Down Expand Up @@ -164,17 +159,6 @@ func (h *ProductEnablementServiceAttributeHandler) Create(_ context.Context, d *
}
}

if resource["ngwaf"].(bool) {
log.Println("[DEBUG] ngwaf set")
_, err := conn.EnableProduct(&gofastly.ProductEnablementInput{
ProductID: gofastly.ProductNGWAF,
ServiceID: serviceID,
})
if err != nil {
return fmt.Errorf("failed to enable ngwaf: %w", err)
}
}

if resource["origin_inspector"].(bool) {
log.Println("[DEBUG] origin_inspector set")
_, err := conn.EnableProduct(&gofastly.ProductEnablementInput{
Expand Down Expand Up @@ -267,13 +251,6 @@ func (h *ProductEnablementServiceAttributeHandler) Read(_ context.Context, d *sc
result["image_optimizer"] = true
}

if _, err := conn.GetProduct(&gofastly.ProductEnablementInput{
ProductID: gofastly.ProductNGWAF,
ServiceID: d.Id(),
}); err == nil {
result["ngwaf"] = true
}

if _, err := conn.GetProduct(&gofastly.ProductEnablementInput{
ProductID: gofastly.ProductOriginInspector,
ServiceID: d.Id(),
Expand Down Expand Up @@ -438,30 +415,6 @@ func (h *ProductEnablementServiceAttributeHandler) Update(_ context.Context, d *
}
}

if v, ok := modified["ngwaf"]; ok {
if v.(bool) {
log.Println("[DEBUG] ngwaf will be enabled")
_, err := conn.EnableProduct(&gofastly.ProductEnablementInput{
ProductID: gofastly.ProductNGWAF,
ServiceID: serviceID,
})
if err != nil {
return fmt.Errorf("failed to enable ngwaf: %w", err)
}
} else {
log.Println("[DEBUG] ngwaf will be disabled")
err := conn.DisableProduct(&gofastly.ProductEnablementInput{
ProductID: gofastly.ProductNGWAF,
ServiceID: serviceID,
})
if err != nil {
if e := h.checkAPIError(err); e != nil {
return e
}
}
}
}

if v, ok := modified["origin_inspector"]; ok {
if v.(bool) {
log.Println("[DEBUG] origin_inspector will be enabled")
Expand Down Expand Up @@ -604,17 +557,6 @@ func (h *ProductEnablementServiceAttributeHandler) Delete(_ context.Context, d *
}
}

log.Println("[DEBUG] disable ngwaf")
err = conn.DisableProduct(&gofastly.ProductEnablementInput{
ProductID: gofastly.ProductNGWAF,
ServiceID: d.Id(),
})
if err != nil {
if e := h.checkAPIError(err); e != nil {
return e
}
}

log.Println("[DEBUG] disable origin_inspector")
err = conn.DisableProduct(&gofastly.ProductEnablementInput{
ProductID: gofastly.ProductOriginInspector,
Expand Down
1 change: 0 additions & 1 deletion fastly/block_fastly_service_product_enablement_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ func TestAccFastlyServiceVCLProductEnablement_basic(t *testing.T) {
brotli_compression = true
domain_inspector = false
image_optimizer = false
ngwaf = false
origin_inspector = false
websockets = false
}
Expand Down

0 comments on commit d2dd941

Please sign in to comment.