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

Add batch job as a cloudwatch_event_target #4312

Merged
merged 5 commits into from
Apr 23, 2018

Conversation

gheine
Copy link

@gheine gheine commented Apr 23, 2018

Fixes #4023

@ghost ghost added the size/L Managed by automation to categorize the size of a PR. label Apr 23, 2018
},
"job_attempts": {
Type: schema.TypeInt,
Required: true,
Copy link
Contributor

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? 😄

Copy link
Author

Choose a reason for hiding this comment

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

Dang! good spot!

@bflad bflad added enhancement Requests to existing resources that expand the functionality or scope. service/batch Issues and PRs that pertain to the batch service. labels Apr 23, 2018
Copy link
Contributor

@bflad bflad left a 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}"
Copy link
Contributor

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}"]
Copy link
Contributor

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.

@ghost ghost added the size/L Managed by automation to categorize the size of a PR. label Apr 23, 2018
@gheine gheine force-pushed the batch_event_target branch from a2764a6 to 47b08e8 Compare April 23, 2018 15:05
@ghost ghost added the size/L Managed by automation to categorize the size of a PR. label Apr 23, 2018
arrayProperties.Size = aws.Int64(int64(v.(int)))
batchParameters.ArrayProperties = arrayProperties
}
if v := param["job_attempts"]; v != nil {
Copy link
Contributor

@bflad bflad Apr 23, 2018

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))),
  }
}

Copy link
Author

Choose a reason for hiding this comment

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

Fixed

@gheine gheine force-pushed the batch_event_target branch from 4249952 to ac458d8 Compare April 23, 2018 16:21
@ghost ghost added the size/L Managed by automation to categorize the size of a PR. label Apr 23, 2018
@bflad bflad added this to the v1.16.0 milestone Apr 23, 2018
Copy link
Contributor

@bflad bflad left a 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)

@bflad bflad merged commit c21a2eb into hashicorp:master Apr 23, 2018
bflad added a commit that referenced this pull request Apr 23, 2018
@gheine gheine deleted the batch_event_target branch April 24, 2018 09:33
@bflad
Copy link
Contributor

bflad commented Apr 25, 2018

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.

@ghost
Copy link

ghost commented Apr 6, 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 6, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/batch Issues and PRs that pertain to the batch service. size/L Managed by automation to categorize the size of a PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add AWS Batch as a cloudwatch_event_target
2 participants