-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Refactor Pinpoint application resource to use keyvaluetags package #11368
Conversation
Waiting for merge of #11352 to add the custom transformation for Pinpoint |
01e3e5e
to
7175be4
Compare
@@ -87,20 +88,24 @@ func resourceAwsPinpointApp() *schema.Resource { | |||
Elem: &schema.Resource{ | |||
Schema: map[string]*schema.Schema{ | |||
"daily": { | |||
Type: schema.TypeInt, | |||
Optional: true, | |||
Type: schema.TypeInt, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add validations as described here for CampaignLimits
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@@ -43,23 +90,18 @@ func TestAccAWSPinpointApp_basic(t *testing.T) { | |||
} | |||
|
|||
func TestAccAWSPinpointApp_CampaignHookLambda(t *testing.T) { | |||
oldDefaultRegion := os.Getenv("AWS_DEFAULT_REGION") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pinpoint is now available in regions other than us-east-1
.
handler = "lambdapinpoint.handler" | ||
runtime = "nodejs8.10" | ||
runtime = "nodejs12.x" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Upgrade Nodejs runtime version - #11514.
@@ -267,76 +293,69 @@ EOF | |||
} | |||
|
|||
data "aws_caller_identity" "aws" {} | |||
data "aws_region" "current" {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Region agnostic - #8316.
This comment has been minimized.
This comment has been minimized.
daily = 3 | ||
maximum_duration = 600 | ||
messages_per_second = 50 | ||
total = 100 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change total
to 100 else we get an error like
--- FAIL: TestAccAWSPinpointApp_Limits (10.75s)
testing.go:640: Step 0 error: errors during apply:
Error: BadRequestException: Campaign Total limit needs to be less than or equal to 100. Value entered: 500
status code: 400, request id: 8ce2c134-a525-45cd-b9b4-f5c54f589e5a
on /var/folders/4j/lf5jdq5j4y91g80ytf6qzjwmk6drp5/T/tf-test284836860/main.tf line 6:
(source code not available)
7175be4
to
615588f
Compare
@@ -330,10 +330,23 @@ func testAccEC2VPCOnlyPreCheck(t *testing.T) { | |||
} | |||
} | |||
|
|||
func testAccHasServicePreCheck(service string, t *testing.T) { | |||
func testAccPartitionHasServicePreCheck(serviceId string, t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename to better explain purpose.
} | ||
} | ||
|
||
func testAccRegionHasServicePreCheck(serviceId string, t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checks that the acceptance test regions supports the specified service.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This addition is okay for this and other particular cases, but experience over time has shown the AWS Go SDK endpoints information continually being out of date for some services, which is why we do not use it in many places. We'll always want to prefer behavioral checks (attempting to call an API) over using the endpoint information. 👍 I will add a comment to this function on merge to note that preference.
|
||
campaign_hook { | ||
lambda_function_name = "${aws_lambda_function.test.arn}" | ||
mode = "DELIVERY" | ||
} | ||
|
||
depends_on = ["aws_lambda_permission.test"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prevents random test failures.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️ Thanks!
Removing WIP. |
615588f
to
1194412
Compare
|
||
resource.ParallelTest(t, resource.TestCase{ | ||
PreCheck: func() { testAccPreCheck(t) }, | ||
PreCheck: func() { testAccPreCheck(t); testAccRegionHasServicePreCheck("pinpoint", t) }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to explicitly pre-check that the test region has the Pinpoint service instead of just failing the test as the Pinpoint APIs hang in unsupported regions rather than return errors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks @ewbankkit 🚀
Output from acceptance testing:
--- PASS: TestAccAWSPinpointApp_basic (15.45s)
--- PASS: TestAccAWSPinpointApp_CampaignHookLambda (47.58s)
--- PASS: TestAccAWSPinpointApp_Limits (22.38s)
--- PASS: TestAccAWSPinpointApp_QuietTime (19.65s)
--- PASS: TestAccAWSPinpointApp_Tags (47.07s)
--- PASS: TestAccAWSS3Bucket_acceleration (38.79s)
} | ||
} | ||
|
||
func testAccRegionHasServicePreCheck(serviceId string, t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This addition is okay for this and other particular cases, but experience over time has shown the AWS Go SDK endpoints information continually being out of date for some services, which is why we do not use it in many places. We'll always want to prefer behavioral checks (attempting to call an API) over using the endpoint information. 👍 I will add a comment to this function on merge to note that preference.
@@ -87,20 +88,24 @@ func resourceAwsPinpointApp() *schema.Resource { | |||
Elem: &schema.Resource{ | |||
Schema: map[string]*schema.Schema{ | |||
"daily": { | |||
Type: schema.TypeInt, | |||
Optional: true, | |||
Type: schema.TypeInt, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
|
||
campaign_hook { | ||
lambda_function_name = "${aws_lambda_function.test.arn}" | ||
mode = "DELIVERY" | ||
} | ||
|
||
depends_on = ["aws_lambda_permission.test"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️ Thanks!
This has been released in version 2.45.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template for triage. Thanks! |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks! |
Community Note
Relates #10688.
Release note for CHANGELOG:
Output from acceptance testing: