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

resource/aws_wafregional_byte_match_set: Remove deprecated byte_match_tuple configuration block #7718

Merged
merged 1 commit into from
Feb 26, 2019
Merged
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
35 changes: 8 additions & 27 deletions aws/resource_aws_wafregional_byte_match_set.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,9 @@ func resourceAwsWafRegionalByteMatchSet() *schema.Resource {
ForceNew: true,
},
"byte_match_tuple": {
Type: schema.TypeSet,
Optional: true,
ConflictsWith: []string{"byte_match_tuples"},
Deprecated: "use `byte_match_tuples` instead",
Type: schema.TypeSet,
Optional: true,
Removed: "use `byte_match_tuples` configuration block(s) instead",
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"field_to_match": {
Expand Down Expand Up @@ -155,15 +154,10 @@ func resourceAwsWafRegionalByteMatchSetRead(d *schema.ResourceData, meta interfa
return nil
}

if _, ok := d.GetOk("byte_match_tuple"); ok {
if err := d.Set("byte_match_tuple", flattenWafByteMatchTuplesWR(resp.ByteMatchSet.ByteMatchTuples)); err != nil {
return fmt.Errorf("error setting byte_match_tuple: %s", err)
}
} else {
if err := d.Set("byte_match_tuples", flattenWafByteMatchTuplesWR(resp.ByteMatchSet.ByteMatchTuples)); err != nil {
return fmt.Errorf("error setting byte_match_tuples: %s", err)
}
if err := d.Set("byte_match_tuples", flattenWafByteMatchTuplesWR(resp.ByteMatchSet.ByteMatchTuples)); err != nil {
return fmt.Errorf("error setting byte_match_tuples: %s", err)
}

d.Set("name", resp.ByteMatchSet.Name)

return nil
Expand Down Expand Up @@ -195,15 +189,7 @@ func resourceAwsWafRegionalByteMatchSetUpdate(d *schema.ResourceData, meta inter
region := meta.(*AWSClient).region
log.Printf("[INFO] Updating ByteMatchSet: %s", d.Get("name").(string))

if d.HasChange("byte_match_tuple") {
o, n := d.GetChange("byte_match_tuple")
oldT, newT := o.(*schema.Set).List(), n.(*schema.Set).List()

err := updateByteMatchSetResourceWR(d, oldT, newT, conn, region)
if err != nil {
return fmt.Errorf("Error updating ByteMatchSet: %s", err)
}
} else if d.HasChange("byte_match_tuples") {
if d.HasChange("byte_match_tuples") {
o, n := d.GetChange("byte_match_tuples")
oldT, newT := o.(*schema.Set).List(), n.(*schema.Set).List()

Expand All @@ -221,12 +207,7 @@ func resourceAwsWafRegionalByteMatchSetDelete(d *schema.ResourceData, meta inter

log.Printf("[INFO] Deleting ByteMatchSet: %s", d.Get("name").(string))

var oldT []interface{}
if _, ok := d.GetOk("byte_match_tuple"); ok {
oldT = d.Get("byte_match_tuple").(*schema.Set).List()
} else {
oldT = d.Get("byte_match_tuples").(*schema.Set).List()
}
oldT := d.Get("byte_match_tuples").(*schema.Set).List()

if len(oldT) > 0 {
var newT []interface{}
Expand Down
2 changes: 1 addition & 1 deletion aws/resource_aws_wafregional_rate_based_rule_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ resource "aws_wafregional_ipset" "ipset" {

resource "aws_wafregional_byte_match_set" "set" {
name = "%s"
byte_match_tuple {
byte_match_tuples {
text_transformation = "NONE"
target_string = "badrefer1"
positional_constraint = "CONTAINS"
Expand Down
1 change: 0 additions & 1 deletion website/docs/r/wafregional_byte_match_set.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ resource "aws_wafregional_byte_match_set" "byte_set" {
The following arguments are supported:

* `name` - (Required) The name or description of the ByteMatchSet.
* `byte_match_tuple` - **Deprecated**, use `byte_match_tuples` instead.
* `byte_match_tuples` - (Optional)Settings for the ByteMatchSet, such as the bytes (typically a string that corresponds with ASCII characters) that you want AWS WAF to search for in web requests. ByteMatchTuple documented below.


Expand Down