Skip to content

Commit 450f0d9

Browse files
authored
Fixes errors and resource cycling issues for aws.batch.JobDefinition (#3888)
Recent changes in hashicorp/terraform-provider-aws#37111 introduced a Diff customizer that leads to errors in the Pulumi version of the provider due to discrepancies in the order in which Diff customizer functions are applied between Pulumi and Terraform. This change fixes the problem by applying the experimental PlanResourceChange flag to the affected resource. Fixes #3887 A regression test is included. See also: pulumi/pulumi-terraform-bridge#1785
1 parent 86fbe94 commit 450f0d9

File tree

7 files changed

+198
-1
lines changed

7 files changed

+198
-1
lines changed

provider/provider_python_test.go

+24
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,30 @@ func TestRegress3196(t *testing.T) {
3636
})
3737
}
3838

39+
func TestRegress3887(t *testing.T) {
40+
if testing.Short() {
41+
t.Skipf("Skipping test in -short mode because it needs cloud credentials")
42+
return
43+
}
44+
test := getPythonBaseOptions(t).
45+
With(integration.ProgramTestOptions{
46+
Quick: true,
47+
SkipRefresh: true,
48+
Dir: filepath.Join("test-programs", "regress-3887"),
49+
EditDirs: []integration.EditDir{
50+
{
51+
Dir: filepath.Join("test-programs", "regress-3887", "step-1"),
52+
Additive: true,
53+
},
54+
{
55+
Dir: filepath.Join("test-programs", "regress-3887", "step-2"),
56+
Additive: true,
57+
},
58+
},
59+
})
60+
integration.ProgramTest(t, &test)
61+
}
62+
3963
func TestRegress1504(t *testing.T) {
4064
if testing.Short() {
4165
t.Skipf("Skipping test in -short mode because it needs cloud credentials")

provider/resources.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -803,7 +803,8 @@ func ProviderFromMeta(metaInfo *tfbridge.MetadataInfo) *tfbridge.ProviderInfo {
803803
switch s {
804804
case "aws_ssm_document",
805805
"aws_wafv2_web_acl",
806-
"aws_launch_template":
806+
"aws_launch_template",
807+
"aws_batch_job_definition":
807808
return true
808809
default:
809810
return false
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
name: regress-3887
2+
runtime:
3+
name: python
4+
options:
5+
virtualenv: venv
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import json
2+
import pulumi_aws as aws
3+
4+
test = aws.batch.JobDefinition(
5+
"test",
6+
name="my_test_batch_job_definition",
7+
type="container",
8+
container_properties=json.dumps(
9+
{
10+
"command": [
11+
"ls",
12+
"-la",
13+
],
14+
"image": "busybox",
15+
"resourceRequirements": [
16+
{
17+
"type": "VCPU",
18+
"value": "1",
19+
},
20+
{
21+
"type": "MEMORY",
22+
"value": "512",
23+
},
24+
],
25+
"volumes": [
26+
{
27+
"host": {
28+
"sourcePath": "/tmp",
29+
},
30+
"name": "tmp",
31+
}
32+
],
33+
"environment": [
34+
{
35+
"name": "VARNAME",
36+
"value": "VARVAL",
37+
}
38+
],
39+
"mountPoints": [
40+
{
41+
"sourceVolume": "tmp",
42+
"containerPath": "/tmp",
43+
"readOnly": False,
44+
}
45+
],
46+
"ulimits": [
47+
{
48+
"hardLimit": 1024,
49+
"name": "nofile",
50+
"softLimit": 1024,
51+
}
52+
],
53+
}
54+
),
55+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
pulumi>=3.0.0,<4.0.0
2+
pulumi_aws>=6.0.0,<7.0.0
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import json
2+
import pulumi_aws as aws
3+
4+
test = aws.batch.JobDefinition(
5+
"test",
6+
name="my_test_batch_job_definition",
7+
type="container",
8+
container_properties=json.dumps(
9+
{
10+
"command": [
11+
"ls",
12+
"-la",
13+
],
14+
"image": "busybox",
15+
"resourceRequirements": [
16+
{
17+
"type": "VCPU",
18+
"value": "2",
19+
},
20+
{
21+
"type": "MEMORY",
22+
"value": "512",
23+
},
24+
],
25+
"volumes": [
26+
{
27+
"host": {
28+
"sourcePath": "/tmp",
29+
},
30+
"name": "tmp",
31+
}
32+
],
33+
"environment": [
34+
{
35+
"name": "VARNAME",
36+
"value": "VARVAL",
37+
}
38+
],
39+
"mountPoints": [
40+
{
41+
"sourceVolume": "tmp",
42+
"containerPath": "/tmp",
43+
"readOnly": False,
44+
}
45+
],
46+
"ulimits": [
47+
{
48+
"hardLimit": 1024,
49+
"name": "nofile",
50+
"softLimit": 1024,
51+
}
52+
],
53+
}
54+
),
55+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import json
2+
import pulumi_aws as aws
3+
4+
test = aws.batch.JobDefinition(
5+
"test",
6+
name="my_test_batch_job_definition",
7+
type="container",
8+
container_properties=json.dumps(
9+
{
10+
"command": [
11+
"ls",
12+
"-la",
13+
],
14+
"image": "busybox",
15+
"resourceRequirements": [
16+
{
17+
"type": "VCPU",
18+
"value": "3",
19+
},
20+
{
21+
"type": "MEMORY",
22+
"value": "512",
23+
},
24+
],
25+
"volumes": [
26+
{
27+
"host": {
28+
"sourcePath": "/tmp",
29+
},
30+
"name": "tmp",
31+
}
32+
],
33+
"environment": [
34+
{
35+
"name": "VARNAME",
36+
"value": "VARVAL",
37+
}
38+
],
39+
"mountPoints": [
40+
{
41+
"sourceVolume": "tmp",
42+
"containerPath": "/tmp",
43+
"readOnly": False,
44+
}
45+
],
46+
"ulimits": [
47+
{
48+
"hardLimit": 1024,
49+
"name": "nofile",
50+
"softLimit": 1024,
51+
}
52+
],
53+
}
54+
),
55+
)

0 commit comments

Comments
 (0)