-
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
Add batch job as a cloudwatch_event_target #4312
Conversation
}, | ||
"job_attempts": { | ||
Type: schema.TypeInt, | ||
Required: true, |
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.
Is this supposed to be optional or required? 😄
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.
Dang! good spot!
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.
Sorry for the piecemeal review 😅 Looks like the testing needs a little love then hopefully we can get this in.
role_arn = "${aws_iam_role.event_iam_role.arn}" | ||
|
||
batch_target { | ||
job_definition = "${aws_batch_job_definition.batch_job_definition}" |
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.
=== RUN TestAccAWSCloudWatchEventTarget_batch
--- FAIL: TestAccAWSCloudWatchEventTarget_batch (1.14s)
testing.go:518: Step 0 error: Error loading configuration: Error loading /opt/teamcity-agent/temp/buildTmp/tf-test953762704/main.tf: Error reading config for aws_cloudwatch_event_target[test]: aws_batch_job_definition.batch_job_definition: resource variables must be three parts: TYPE.NAME.ATTR in:
${aws_batch_job_definition.batch_job_definition}
name = "%[1]s" | ||
state = "ENABLED" | ||
priority = 1 | ||
compute_environments = ["${aws_batch_compute_environment.batch_compute_environment}"] |
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.
Missing attribute here as well.
a2764a6
to
47b08e8
Compare
arrayProperties.Size = aws.Int64(int64(v.(int))) | ||
batchParameters.ArrayProperties = arrayProperties | ||
} | ||
if v := param["job_attempts"]; v != nil { |
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.
We probably need to check against 0 value here:
=== RUN TestAccAWSCloudWatchEventTarget_batch
--- FAIL: TestAccAWSCloudWatchEventTarget_batch (74.46s)
testing.go:518: Step 0 error: Error applying: 1 error(s) occurred:
* aws_cloudwatch_event_target.test: 1 error(s) occurred:
* aws_cloudwatch_event_target.test: Creating CloudWatch Event Target failed: ValidationException: Parameter RetryStrategy is not valid. Reason: Attempts must be in between 1 and 10.
status code: 400, request id: c8444d59-4708-11e8-8e5f-157f2dececc3
if v := param["job_attempts"]; v != nil && v.(int) != 0 {
batchParameters.RetryStrategy = &events.BatchRetryStrategy{
Attempts: aws.Int64(int64(v.(int))),
}
}
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.
Fixed
4249952
to
ac458d8
Compare
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 @gheine, looks good! 🚀
7 tests passed (all tests)
=== RUN TestAccAWSCloudWatchEventTarget_missingTargetId
--- PASS: TestAccAWSCloudWatchEventTarget_missingTargetId (7.56s)
=== RUN TestAccAWSCloudWatchEventTarget_ssmDocument
--- PASS: TestAccAWSCloudWatchEventTarget_ssmDocument (9.81s)
=== RUN TestAccAWSCloudWatchEventTarget_ecs
--- PASS: TestAccAWSCloudWatchEventTarget_ecs (9.82s)
=== RUN TestAccAWSCloudWatchEventTarget_basic
--- PASS: TestAccAWSCloudWatchEventTarget_basic (11.10s)
=== RUN TestAccAWSCloudWatchEventTarget_input_transformer
--- PASS: TestAccAWSCloudWatchEventTarget_input_transformer (24.47s)
=== RUN TestAccAWSCloudWatchEventTarget_batch
--- PASS: TestAccAWSCloudWatchEventTarget_batch (68.91s)
=== RUN TestAccAWSCloudWatchEventTarget_full
--- PASS: TestAccAWSCloudWatchEventTarget_full (76.15s)
This has been released in version 1.16.0 of the AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. |
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! |
Fixes #4023