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_lambda_event_source_mapping: Add starting_position_timestamp argument #6437

Merged

Conversation

bflad
Copy link
Contributor

@bflad bflad commented Nov 12, 2018

This argument, like starting_position, is only used during resource creation and therefore cannot be updated or read from the Lambda API.

Changes proposed in this pull request:

  • resource/aws_lambda_event_source_mapping: Add starting_position_timestamp argument
  • docs/resource/aws_lambda_event_source_mapping: Show DynamoDB, Kinesis, and SQS example usage

Output from acceptance testing:

--- PASS: TestAccAWSLambdaEventSourceMapping_sqs_withFunctionName (43.90s)
--- PASS: TestAccAWSLambdaEventSourceMapping_kinesis_disappears (85.32s)
--- PASS: TestAccAWSLambdaEventSourceMapping_kinesis_import (87.35s)
--- PASS: TestAccAWSLambdaEventSourceMapping_StartingPositionTimestamp (87.99s)
--- PASS: TestAccAWSLambdaEventSourceMapping_kinesis_removeBatchSize (92.56s)
--- PASS: TestAccAWSLambdaEventSourceMapping_kinesis_basic (94.66s)
--- PASS: TestAccAWSLambdaEventSourceMapping_sqs_basic (108.48s)
--- PASS: TestAccAWSLambdaEventSourceMapping_sqsDisappears (121.69s)
--- PASS: TestAccAWSLambdaEventSourceMapping_changesInEnabledAreDetected (122.55s)

…tamp argument

This argument, like `starting_position`, is only used during resource creation and thereforce cannot be updated or read from the Lambda API.

```
--- PASS: TestAccAWSLambdaEventSourceMapping_sqs_withFunctionName (43.90s)
--- PASS: TestAccAWSLambdaEventSourceMapping_kinesis_disappears (85.32s)
--- PASS: TestAccAWSLambdaEventSourceMapping_kinesis_import (87.35s)
--- PASS: TestAccAWSLambdaEventSourceMapping_StartingPositionTimestamp (87.99s)
--- PASS: TestAccAWSLambdaEventSourceMapping_kinesis_removeBatchSize (92.56s)
--- PASS: TestAccAWSLambdaEventSourceMapping_kinesis_basic (94.66s)
--- PASS: TestAccAWSLambdaEventSourceMapping_sqs_basic (108.48s)
--- PASS: TestAccAWSLambdaEventSourceMapping_sqsDisappears (121.69s)
--- PASS: TestAccAWSLambdaEventSourceMapping_changesInEnabledAreDetected (122.55s)
```
@bflad bflad added enhancement Requests to existing resources that expand the functionality or scope. service/lambda Issues and PRs that pertain to the lambda service. labels Nov 12, 2018
@bflad bflad requested a review from a team November 12, 2018 21:10
@ghost ghost added size/L Managed by automation to categorize the size of a PR. documentation Introduces or discusses updates to documentation. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. labels Nov 12, 2018
@@ -136,6 +148,11 @@ func resourceAwsLambdaEventSourceMappingCreate(d *schema.ResourceData, meta inte
params.StartingPosition = aws.String(startingPosition.(string))
}

if startingPositionTimestamp, ok := d.GetOk("starting_position_timestamp"); ok {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we also need to confirm that starting_position is also lambda.EventSourcePositionAtTimestamp or can this be specified without it?

Copy link
Contributor Author

@bflad bflad Nov 12, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The API returns an error if its incorrectly set (e.g. starting_position = "LATEST" and starting_position_timestamp = "..."): InvalidParameterValueException: Timestamp only valid with StartingPosition AT_TIMESTAMP

Since the API returns a helpful error and CustomizeDiff has a lot of issues for cross-attribute validation, we try to avoid the extra coding, but I can add it in there if you wish.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need! That makes sense to me!

Copy link
Member

@mbfrahry mbfrahry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@bflad bflad added this to the v1.44.0 milestone Nov 13, 2018
@bflad bflad merged commit 81fbf28 into master Nov 13, 2018
@bflad bflad deleted the f-aws_lambda_event_source_mapping-starting_position_timestamp branch November 13, 2018 14:13
bflad added a commit that referenced this pull request Nov 13, 2018
@bflad
Copy link
Contributor Author

bflad commented Nov 15, 2018

This has been released in version 1.44.0 of the AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

@ghost
Copy link

ghost commented Apr 2, 2020

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!

@ghost ghost locked and limited conversation to collaborators Apr 2, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Introduces or discusses updates to documentation. enhancement Requests to existing resources that expand the functionality or scope. service/lambda Issues and PRs that pertain to the lambda service. size/L Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants