Skip to content

Commit 6b5e42c

Browse files
authored
Merge pull request #101 from imperva/cname_and_ttl
support sctrict_cname_reuse and fix ttl
2 parents 1e5b264 + 8938be0 commit 6b5e42c

File tree

4 files changed

+11
-2
lines changed

4 files changed

+11
-2
lines changed

incapsula/client_cache_rule.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ type CacheRule struct {
1515
Action string `json:"action"`
1616
Filter string `json:"filter"`
1717
Enabled bool `json:"enabled"`
18-
TTL int `json:"ttl,omitempty"`
18+
TTL int `json:"ttl"`
1919
IgnoredParams string `json:"ignored_params,omitempty"`
2020
Text string `json:"text,omitempty"`
2121
DifferentiateByValue string `json:"differentiate_by_value,omitempty"`

incapsula/client_site.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ type SiteStatusResponse struct {
5656
} `json:"original_dns"`
5757
Warnings []interface{} `json:"warnings"`
5858
Active string `json:"active"`
59+
RestrictedCnameReuse bool `json:"restricted_cname_reuse,omitempty"`
5960
SupportAllTLSVersions bool `json:"support_all_tls_versions"`
6061
UseWildcardSanInsteadOfFullDomainSan bool `json:"use_wildcard_san_instead_of_full_domain_san"`
6162
AddNakedDomainSan bool `json:"add_naked_domain_san"`

incapsula/resource_site.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,12 @@ func resourceSite() *schema.Resource {
113113
Optional: true,
114114
Computed: true,
115115
},
116+
"restricted_cname_reuse": {
117+
Description: "Use this option to allow Imperva to detect and add domains that are using the Imperva-provided CNAME (not recommended). One of: true | false",
118+
Type: schema.TypeString,
119+
Optional: true,
120+
Computed: true,
121+
},
116122
"domain_redirect_to_full": {
117123
Description: "true or empty string.",
118124
Type: schema.TypeString,
@@ -437,6 +443,7 @@ func resourceSiteRead(d *schema.ResourceData, m interface{}) error {
437443
d.Set("wildcard_san", siteStatusResponse.UseWildcardSanInsteadOfFullDomainSan)
438444
d.Set("acceleration_level", siteStatusResponse.AccelerationLevelRaw)
439445
d.Set("active", siteStatusResponse.Active)
446+
d.Set("restricted_cname_reuse", strconv.FormatBool(siteStatusResponse.RestrictedCnameReuse))
440447
d.Set("seal_location", siteStatusResponse.SealLocation.ID)
441448

442449
// Set the DNS information
@@ -612,7 +619,7 @@ func resourceSiteDelete(d *schema.ResourceData, m interface{}) error {
612619
}
613620

614621
func updateAdditionalSiteProperties(client *Client, d *schema.ResourceData) error {
615-
updateParams := [9]string{"acceleration_level", "active", "approver", "domain_redirect_to_full", "domain_validation", "ignore_ssl", "remove_ssl", "ref_id", "seal_location"}
622+
updateParams := [10]string{"acceleration_level", "active", "approver", "domain_redirect_to_full", "domain_validation", "ignore_ssl", "remove_ssl", "ref_id", "seal_location", "restricted_cname_reuse"}
616623
for i := 0; i < len(updateParams); i++ {
617624
param := updateParams[i]
618625
if d.HasChange(param) && d.Get(param) != "" {

website/docs/r/site.html.markdown

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ The following arguments are supported:
6262
* `force_ssl` - (Optional) Force SSL. This option is only available for sites with manually configured IP/CNAME and for specific accounts.
6363
* `logs_account_id` - (Optional) Account where logs should be stored. Available only for Enterprise Plan customers that purchased the Logs Integration SKU. Numeric identifier of the account that purchased the logs integration SKU and which collects the logs. If not specified, operation will be performed on the account identified by the authentication parameters.
6464
* `active` - (Optional) Whether the site is active or bypassed by the Imperva network. Options are `active` and `bypass`.
65+
* `restricted_cname_reuse` - (Optional) Use this option to allow Imperva to detect and add domains that are using the Imperva-provided CNAME (not recommended). One of: true | false.
6566
* `domain_validation` - (Optional) Sets the domain validation method that will be used to generate an SSL certificate. Options are `email`, `html`, and `dns`.
6667
* `approver` - (Optional) Sets the approver e-mail address that will be used to perform SSL domain validation.
6768
* `ignore_ssl` - (Optional) Sets the ignore SSL flag (if the site is in pending-select-approver state). Pass "true" or empty string in the value parameter.

0 commit comments

Comments
 (0)