Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Destroying incapsula_site doesn't give option to ignore grace period #479

Open
2 tasks done
liamrob opened this issue Nov 22, 2024 · 0 comments
Open
2 tasks done

Comments

@liamrob
Copy link

liamrob commented Nov 22, 2024

Confirmation

  • My issue isn't already found on the issue tracker.
  • I have replicated my issue using the latest version of the provider and it is still present.

Terraform and Imperva provider version

3.27.1

Affected resource(s)

incapsula_site

Terraform configuration files

#incapsula_site.example will be destroyed
 resource "incapsula_site" "example" {
     #...
 }

Debug output

[INFO]  plugin.terraform-provider-incapsula_v3.27.1: 2024/11/20 16:01:33 [DEBUG] Incapsula add site JSON response: <html>
<head><META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW"><title>504 Gateway Time-out</title></head>
<body>
<center><h1>504 Gateway Time-out</h1></center>
<hr><center>nginx</center>
<script>
/*(function () {
    var s = document.createElement('script');
    s.type = 'text/javascript';
    s.async = true;
    s.src = 'https://sec1.aws.incapsula.mobi/js/JEPTPROD?t=' + new Date().getTime();
    document.body.appendChild(s);
})();*/
</script><script type="text/javascript" src="/_Incapsula_Resource?SWJIYLWA=719d34d31c8e3a6e6fffd425f7e032f3&ns=3&cb=567517665" async></script></body>
</html>

Panic output

No response

Expected output

Actual output

Site is cached by Imperva proxies under a 24 hour grace period.
Subsequent requests to re-create the site within that period failed with:

 Error parsing add site JSON response for domain example.com: invalid character '<' looking for beginning of value

Steps to reproduce

  1. Deploy a site
  2. Destroy the site
  3. Re-deploy the site (within 24 hours)

Additional factoids

Looks like we're not providing ability to pass api param ignore_grace_period and therefore default behaviour is being applied to cache the site config:

values := url.Values{"site_id": {strconv.Itoa(siteID)}}

doc: https://docs.imperva.com/bundle/cloud-application-security/page/cloud-v1-api-definition.htm
api: /api/prov/v1/sites/delete

can't see it being added in v3 client either, looks like a wrapper around it

suggestion the default behaviour is added as a feature to the provider?

provider "incapsula" {
  api_id = "${var.incapsula_api_id}"
  api_key = "${var.incapsula_api_key}"
  features {
      ignore_grace_period_during_site_deletion = true
  }
}

References

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant