-
Notifications
You must be signed in to change notification settings - Fork 156
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #3075 The problem was that the tf migration didn't migrate the ARN property of the job queue resource. Looks like this isn't a problem for tf programs, likely because tf does a refresh during update. This PR adds a patch and an upgrade test for this. --------- Co-authored-by: Anton Tayanovskyy <[email protected]>
- Loading branch information
1 parent
c092200
commit 5029829
Showing
8 changed files
with
910 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
diff --git a/internal/service/batch/job_queue_schema.go b/internal/service/batch/job_queue_schema.go | ||
index bd19814922..11cf093ece 100644 | ||
--- a/internal/service/batch/job_queue_schema.go | ||
+++ b/internal/service/batch/job_queue_schema.go | ||
@@ -92,6 +92,7 @@ func upgradeJobQueueResourceStateV0toV1(ctx context.Context, req resource.Upgrad | ||
} | ||
|
||
jobQueueDataV2 := resourceJobQueueData{ | ||
+ ARN: jobQueueDataV0.ARN, | ||
ComputeEnvironments: jobQueueDataV0.ComputeEnvironments, | ||
ID: jobQueueDataV0.ID, | ||
Name: jobQueueDataV0.Name, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
name: job-queue | ||
description: Job Queue | ||
runtime: nodejs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
import * as aws from "@pulumi/aws"; | ||
|
||
const ec2AssumeRole = aws.iam.getPolicyDocument({ | ||
statements: [{ | ||
actions: ["sts:AssumeRole"], | ||
effect: "Allow", | ||
principals: [{ | ||
identifiers: ["ec2.amazonaws.com"], | ||
type: "Service", | ||
}], | ||
}], | ||
}); | ||
|
||
const ecsInstanceRole = new aws.iam.Role("ecsInstanceRoleRole", { | ||
assumeRolePolicy: ec2AssumeRole.then(policy => policy.json), | ||
}); | ||
|
||
const ecsPolicyAttachment = new aws.iam.RolePolicyAttachment("ecsInstanceRoleRolePolicyAttachment", { | ||
role: ecsInstanceRole.name, | ||
policyArn: "arn:aws:iam::aws:policy/service-role/AmazonEC2ContainerServiceforEC2Role", | ||
}); | ||
|
||
const ecsInstanceProfile = new aws.iam.InstanceProfile("ecsInstanceRoleInstanceProfile", { | ||
role: ecsInstanceRole.name, | ||
}); | ||
|
||
const batchAssumeRole = aws.iam.getPolicyDocument({ | ||
statements: [{ | ||
actions: ["sts:AssumeRole"], | ||
effect: "Allow", | ||
principals: [{ | ||
identifiers: ["batch.amazonaws.com"], | ||
type: "Service", | ||
}], | ||
}], | ||
}); | ||
|
||
const batchRole = new aws.iam.Role("awsBatchServiceRoleRole", { | ||
assumeRolePolicy: batchAssumeRole.then(policy => policy.json), | ||
}); | ||
|
||
const batchPolicyAttachment = new aws.iam.RolePolicyAttachment("awsBatchServiceRoleRolePolicyAttachment", { | ||
role: batchRole.name, | ||
policyArn: "arn:aws:iam::aws:policy/service-role/AWSBatchServiceRole", | ||
}); | ||
|
||
const sg = new aws.ec2.SecurityGroup("sampleSecurityGroup", { | ||
egress: [{ | ||
cidrBlocks: ["0.0.0.0/0"], | ||
fromPort: 0, | ||
protocol: "-1", | ||
toPort: 0, | ||
}], | ||
}); | ||
|
||
const vpc = new aws.ec2.Vpc("sampleVpc", { cidrBlock: "10.1.0.0/16" }); | ||
|
||
const subnet = new aws.ec2.Subnet("sampleSubnet", { | ||
cidrBlock: "10.1.1.0/24", | ||
vpcId: vpc.id, | ||
}); | ||
|
||
const computeEnvironment = new aws.batch.ComputeEnvironment("sampleComputeEnvironment", { | ||
computeResources: { | ||
instanceRole: ecsInstanceProfile.arn, | ||
instanceTypes: ["c4.large"], | ||
maxVcpus: 16, | ||
minVcpus: 0, | ||
securityGroupIds: [sg.id], | ||
subnets: [subnet.id], | ||
type: "EC2", | ||
}, | ||
serviceRole: batchRole.arn, | ||
type: "MANAGED", | ||
}); | ||
|
||
|
||
const jobQueue = new aws.batch.JobQueue("testQueue", { | ||
computeEnvironments: [computeEnvironment.arn], | ||
priority: 1, | ||
state: "ENABLED", | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"name": "job-queue", | ||
"version": "0.1.0", | ||
"license": "Apache-2.0", | ||
"scripts": { | ||
"build": "tsc" | ||
}, | ||
"dependencies": { | ||
"@pulumi/pulumi": "^3.0.0", | ||
"@pulumi/aws": "^5.0.0" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^8.0.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"compilerOptions": { | ||
"outDir": "bin", | ||
"target": "es2016", | ||
"module": "commonjs", | ||
"moduleResolution": "node", | ||
"sourceMap": true, | ||
"experimentalDecorators": true, | ||
"pretty": true, | ||
"noFallthroughCasesInSwitch": true, | ||
"noImplicitReturns": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"strictNullChecks": true | ||
}, | ||
"files": [ | ||
"index.ts" | ||
] | ||
} |
Oops, something went wrong.