Skip to content

Commit

Permalink
Merge pull request #19654 from hashicorp/b-aws_cloudwatch_event_api_d…
Browse files Browse the repository at this point in the history
…estination-int64-crash

r/aws_cloudwatch_event_api_destination: Fix crash on update
  • Loading branch information
ewbankkit authored Jun 3, 2021
2 parents 04b1377 + 550aac9 commit 54bffa4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
3 changes: 3 additions & 0 deletions .changelog/19654.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
resource/aws_cloudwatch_event_api_destination: Fix crash on resource update
```
2 changes: 1 addition & 1 deletion aws/resource_aws_cloudwatch_event_api_destination.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ func resourceAwsCloudWatchEventApiDestinationUpdate(d *schema.ResourceData, meta
input.InvocationEndpoint = aws.String(invocationEndpoint.(string))
}
if invocationRateLimitPerSecond, ok := d.GetOk("invocation_rate_limit_per_second"); ok {
input.InvocationRateLimitPerSecond = aws.Int64(invocationRateLimitPerSecond.(int64))
input.InvocationRateLimitPerSecond = aws.Int64(int64(invocationRateLimitPerSecond.(int)))
}
if httpMethod, ok := d.GetOk("http_method"); ok {
input.HttpMethod = aws.String(httpMethod.(string))
Expand Down
11 changes: 5 additions & 6 deletions aws/resource_aws_cloudwatch_event_api_destination_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"testing"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/cloudwatchevents"
events "github.com/aws/aws-sdk-go/service/cloudwatchevents"
"github.com/hashicorp/go-multierror"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest"
Expand Down Expand Up @@ -84,7 +83,7 @@ func TestAccAWSCloudWatchEventApiDestination_basic(t *testing.T) {

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ErrorCheck: testAccErrorCheck(t, cloudwatchevents.EndpointsID),
ErrorCheck: testAccErrorCheck(t, events.EndpointsID),
Providers: testAccProviders,
CheckDestroy: testAccCheckAWSCloudWatchEventApiDestinationDestroy,
Steps: []resource.TestStep{
Expand Down Expand Up @@ -157,7 +156,7 @@ func TestAccAWSCloudWatchEventApiDestination_optional(t *testing.T) {

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ErrorCheck: testAccErrorCheck(t, cloudwatchevents.EndpointsID),
ErrorCheck: testAccErrorCheck(t, events.EndpointsID),
Providers: testAccProviders,
CheckDestroy: testAccCheckAWSCloudWatchEventApiDestinationDestroy,
Steps: []resource.TestStep{
Expand Down Expand Up @@ -207,7 +206,7 @@ func TestAccAWSCloudWatchEventApiDestination_optional(t *testing.T) {
invocationEndpointModified,
httpMethodModified,
descriptionModified,
int64(invocationRateLimitPerSecondModified),
int64(invocationRateLimitPerSecond),
),
Check: resource.ComposeTestCheckFunc(
testAccCheckCloudWatchEventApiDestinationExists(resourceName, &v3),
Expand All @@ -216,7 +215,7 @@ func TestAccAWSCloudWatchEventApiDestination_optional(t *testing.T) {
resource.TestCheckResourceAttr(resourceName, "http_method", httpMethodModified),
resource.TestCheckResourceAttr(resourceName, "invocation_endpoint", invocationEndpointModified),
resource.TestCheckResourceAttr(resourceName, "description", descriptionModified),
resource.TestCheckResourceAttr(resourceName, "invocation_rate_limit_per_second", fmt.Sprint(invocationRateLimitPerSecondModified)),
resource.TestCheckResourceAttr(resourceName, "invocation_rate_limit_per_second", fmt.Sprint(invocationRateLimitPerSecond)),
),
},
},
Expand All @@ -233,7 +232,7 @@ func TestAccAWSCloudWatchEventApiDestination_disappears(t *testing.T) {

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ErrorCheck: testAccErrorCheck(t, cloudwatchevents.EndpointsID),
ErrorCheck: testAccErrorCheck(t, events.EndpointsID),
Providers: testAccProviders,
CheckDestroy: testAccCheckAWSCloudWatchEventApiDestinationDestroy,
Steps: []resource.TestStep{
Expand Down

0 comments on commit 54bffa4

Please sign in to comment.