Skip to content

Commit a2fa6bf

Browse files
committed
fix ci issues
1 parent 38c7147 commit a2fa6bf

5 files changed

+29
-53
lines changed

internal/service/batch/compute_environment.go

+7-7
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ func resourceComputeEnvironmentCreate(ctx context.Context, d *schema.ResourceDat
329329
return sdkdiag.AppendErrorf(diags, "Create Batch Compute Environment extra arguments through UpdateComputeEnvironment (%s): %s", d.Id(), err)
330330
}
331331

332-
if _, err := waitComputeEnvironmentUpdated(ctx, conn, d.Id(), d.Timeout(schema.TimeoutUpdate)); err != nil {
332+
if err := waitComputeEnvironmentUpdated(ctx, conn, d.Id(), d.Timeout(schema.TimeoutUpdate)); err != nil {
333333
return sdkdiag.AppendErrorf(diags, "Create waiting for Batch Compute Environment (%s) extra arguments through UpdateComputeEnvironment: %s", d.Id(), err)
334334
}
335335
}
@@ -521,7 +521,7 @@ func resourceComputeEnvironmentUpdate(ctx context.Context, d *schema.ResourceDat
521521
return sdkdiag.AppendErrorf(diags, "updating Batch Compute Environment (%s): %s", d.Id(), err)
522522
}
523523

524-
if _, err := waitComputeEnvironmentUpdated(ctx, conn, d.Id(), d.Timeout(schema.TimeoutUpdate)); err != nil {
524+
if err := waitComputeEnvironmentUpdated(ctx, conn, d.Id(), d.Timeout(schema.TimeoutUpdate)); err != nil {
525525
return sdkdiag.AppendErrorf(diags, "waiting for Batch Compute Environment (%s) update: %s", d.Id(), err)
526526
}
527527
}
@@ -796,7 +796,7 @@ func waitComputeEnvironmentDisabled(ctx context.Context, conn *batch.Batch, name
796796
return nil, err
797797
}
798798

799-
func waitComputeEnvironmentUpdated(ctx context.Context, conn *batch.Batch, name string, timeout time.Duration) (*batch.ComputeEnvironmentDetail, error) {
799+
func waitComputeEnvironmentUpdated(ctx context.Context, conn *batch.Batch, name string, timeout time.Duration) error {
800800
stateConf := &retry.StateChangeConf{
801801
Pending: []string{batch.CEStatusUpdating},
802802
Target: []string{batch.CEStatusValid},
@@ -806,11 +806,11 @@ func waitComputeEnvironmentUpdated(ctx context.Context, conn *batch.Batch, name
806806

807807
outputRaw, err := stateConf.WaitForStateContext(ctx)
808808

809-
if v, ok := outputRaw.(*batch.ComputeEnvironmentDetail); ok {
810-
return v, err
809+
if _, ok := outputRaw.(*batch.ComputeEnvironmentDetail); ok {
810+
return err
811811
}
812812

813-
return nil, err
813+
return err
814814
}
815815

816816
func isFargateType(computeResourceType string) bool {
@@ -1265,7 +1265,7 @@ func expandComputeEnvironmentUpdatePolicy(l []interface{}) *batch.UpdatePolicy {
12651265

12661266
up := &batch.UpdatePolicy{
12671267
JobExecutionTimeoutMinutes: aws.Int64(int64(m["job_execution_timeout_minutes"].(int))),
1268-
TerminateJobsOnUpdate: aws.Bool(bool(m["terminate_jobs_on_update"].(bool))),
1268+
TerminateJobsOnUpdate: aws.Bool(m["terminate_jobs_on_update"].(bool)),
12691269
}
12701270

12711271
return up

internal/service/batch/compute_environment_data_source_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ resource "aws_batch_compute_environment" "test" {
136136
type = "EC2"
137137
}
138138
139-
type = "MANAGED"
139+
type = "MANAGED"
140140
}
141141
142142
data "aws_batch_compute_environment" "by_name" {

internal/service/batch/compute_environment_test.go

+14-38
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ func TestAccBatchComputeEnvironment_updatePolicyUpdate(t *testing.T) {
428428
CheckDestroy: testAccCheckComputeEnvironmentDestroy(ctx),
429429
Steps: []resource.TestStep{
430430
{
431-
Config: testAccComputeEnvironmentConfig_ec2UpdatePolicyUpdate(rName),
431+
Config: testAccComputeEnvironmentConfig_ec2UpdatePolicyOmitted(rName),
432432
Check: resource.ComposeAggregateTestCheckFunc(
433433
testAccCheckComputeEnvironmentExists(ctx, resourceName, &ce),
434434
acctest.CheckResourceAttrRegionalARN(resourceName, "arn", "batch", fmt.Sprintf("compute-environment/%s", rName)),
@@ -2488,11 +2488,11 @@ resource "aws_batch_compute_environment" "test" {
24882488
compute_environment_name = %[1]q
24892489
24902490
compute_resources {
2491-
allocation_strategy = "BEST_FIT_PROGRESSIVE"
2491+
allocation_strategy = "BEST_FIT_PROGRESSIVE"
24922492
instance_role = aws_iam_instance_profile.ecs_instance.arn
2493-
instance_type = ["optimal"]
2493+
instance_type = ["optimal"]
24942494
max_vcpus = 4
2495-
min_vcpus = 0
2495+
min_vcpus = 0
24962496
security_group_ids = [
24972497
aws_security_group.test.id
24982498
]
@@ -2501,39 +2501,15 @@ resource "aws_batch_compute_environment" "test" {
25012501
]
25022502
type = "EC2"
25032503
}
2504-
update_policy {
2505-
job_execution_timeout_minutes = %[2]d
2506-
terminate_jobs_on_update = %[3]v
2507-
}
2508-
2509-
type = "MANAGED"
2510-
}
2511-
`, rName, timeout, terminate))
2512-
}
25132504
2514-
func testAccComputeEnvironmentConfig_ec2UpdatePolicyUpdate(rName string) string {
2515-
return acctest.ConfigCompose(testAccComputeEnvironmentConfig_baseDefaultSLR(rName), fmt.Sprintf(`
2516-
resource "aws_batch_compute_environment" "test" {
2517-
compute_environment_name = %[1]q
2518-
2519-
compute_resources {
2520-
allocation_strategy = "BEST_FIT_PROGRESSIVE"
2521-
instance_role = aws_iam_instance_profile.ecs_instance.arn
2522-
instance_type = ["optimal"]
2523-
max_vcpus = 4
2524-
min_vcpus = 0
2525-
security_group_ids = [
2526-
aws_security_group.test.id
2527-
]
2528-
subnets = [
2529-
aws_subnet.test.id
2530-
]
2531-
type = "EC2"
2505+
update_policy {
2506+
job_execution_timeout_minutes = %[2]d
2507+
terminate_jobs_on_update = %[3]v
25322508
}
25332509
2534-
type = "MANAGED"
2510+
type = "MANAGED"
25352511
}
2536-
`, rName))
2512+
`, rName, timeout, terminate))
25372513
}
25382514

25392515
func testAccComputeEnvironmentConfig_ec2UpdatePolicyOmitted(rName string) string {
@@ -2542,12 +2518,12 @@ resource "aws_batch_compute_environment" "test" {
25422518
compute_environment_name = %[1]q
25432519
25442520
compute_resources {
2545-
allocation_strategy = "BEST_FIT_PROGRESSIVE"
2521+
allocation_strategy = "BEST_FIT_PROGRESSIVE"
25462522
instance_role = aws_iam_instance_profile.ecs_instance.arn
2547-
instance_type = ["optimal"]
2523+
instance_type = ["optimal"]
25482524
max_vcpus = 4
2549-
min_vcpus = 0
2550-
security_group_ids = [
2525+
min_vcpus = 0
2526+
security_group_ids = [
25512527
aws_security_group.test.id
25522528
]
25532529
subnets = [
@@ -2556,7 +2532,7 @@ resource "aws_batch_compute_environment" "test" {
25562532
type = "EC2"
25572533
}
25582534
2559-
type = "MANAGED"
2535+
type = "MANAGED"
25602536
}
25612537
`, rName))
25622538
}

website/docs/d/batch_compute_environment.html.markdown

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,5 @@ This data source exports the following attributes in addition to the arguments a
3636
* `status` - Current status of the compute environment (for example, `CREATING` or `VALID`).
3737
* `status_reason` - Short, human-readable string to provide additional details about the current status of the compute environment.
3838
* `state` - State of the compute environment (for example, `ENABLED` or `DISABLED`). If the state is `ENABLED`, then the compute environment accepts jobs from a queue and can scale out automatically based on queues.
39-
* `update_policy` - (Optional) Specifies the infrastructure update policy for the compute environment.
39+
* `update_policy` - (Optional) Specifies the infrastructure update policy for the compute environment.
4040
* `tags` - Key-value map of resource tags

website/docs/r/batch_compute_environment.html.markdown

+6-6
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ resource "aws_batch_compute_environment" "sample" {
167167
instance_type = ["optimal"]
168168
max_vcpus = 4
169169
min_vcpus = 0
170-
security_group_ids = [
170+
security_group_ids = [
171171
aws_security_group.sample.id
172172
]
173173
subnets = [
@@ -176,12 +176,12 @@ resource "aws_batch_compute_environment" "sample" {
176176
type = "EC2"
177177
}
178178
179-
update_policy {
180-
job_execution_timeout_minutes = 30
181-
terminate_jobs_on_update = false
182-
}
179+
update_policy {
180+
job_execution_timeout_minutes = 30
181+
terminate_jobs_on_update = false
182+
}
183183
184-
type = "MANAGED"
184+
type = "MANAGED"
185185
}
186186
```
187187

0 commit comments

Comments
 (0)