11# Job Definition
22resource "aws_batch_job_definition" "generate_batch_jd_input" {
3- name = " ${ var . prefix } -input"
4- type = " container"
5- container_properties = << CONTAINER_PROPERTIES
6- {
7- "image": "${ local . account_id } .dkr.ecr.us-west-2.amazonaws.com/${ var . prefix } -input",
8- "executionRoleArn": "${ data . aws_iam_role . exe_role . arn } ",
9- "jobRoleArn": "${ data . aws_iam_role . job_role . arn } ",
10- "fargatePlatformConfiguration": { "platformVersion": "LATEST" },
11- "logConfiguration": {
12- "logDriver" : "awslogs",
13- "options": {
14- "awslogs-group" : "${ data . aws_cloudwatch_log_group . cw_log_group . name } "
15- }
16- },
17- "resourceRequirements": [
18- {"type": "MEMORY", "value": "1024"},
19- {"type": "VCPU", "value": "0.5"}
20- ],
21- "mountPoints": [
22- {
23- "sourceVolume": "input",
24- "containerPath": "/mnt/data"
3+ name = " ${ var . prefix } -input"
4+ type = " container"
5+ platform_capabilities = [" FARGATE" ]
6+ propagate_tags = true
7+ tags = { " job_definition" : " ${ var . prefix } -input" }
8+
9+ container_properties = jsonencode ({
10+ image = " ${ local . account_id } .dkr.ecr.us-west-2.amazonaws.com/${ var . prefix } -input:${ var . image_tag } "
11+ executionRoleArn = var.iam_execution_role_arn
12+ jobRoleArn = var.iam_job_role_arn
13+ fargatePlatformConfiguration = {
14+ platformVersion = " LATEST"
15+ }
16+ logConfiguration = {
17+ logDriver = " awslogs"
18+ options = {
19+ awslogs-group = aws_cloudwatch_log_group.cw_log_group.name
2520 }
26- ],
27- "volumes": [
28- {
29- "name": "input",
30- "efsVolumeConfiguration": {
31- "fileSystemId": "${ data . aws_efs_file_system . aws_efs_input . file_system_id } ",
32- "rootDirectory": "/"
33- }
21+ }
22+ resourceRequirements = [{
23+ type = " MEMORY"
24+ value = " 1024"
25+ }, {
26+ type = " VCPU" ,
27+ value = " 0.5"
28+ }]
29+ mountPoints = [{
30+ sourceVolume = " input" ,
31+ containerPath = " /mnt/data"
32+ readOnly = false
33+ }]
34+ volumes = [{
35+ name = " input"
36+ efsVolumeConfiguration = {
37+ fileSystemId = var.efs_file_system_ids[" input" ]
38+ rootDirectory = " /"
3439 }
35- ]
36- }
37- CONTAINER_PROPERTIES
38- platform_capabilities = [" FARGATE" ]
39- propagate_tags = true
40- tags = { " job_definition" : " ${ var . prefix } -input" }
40+ }]
41+ })
4142}
4243
4344# API key parameter
4445resource "aws_ssm_parameter" "hydrocron_key_parameter" {
45- name = " ${ var . prefix } -hydrocron-key"
46+ name = " ${ var . prefix } -hydrocron-key"
4647 description = " Hydrocron confluence API key"
47- type = " SecureString"
48- value = var. api_key
49- overwrite = true
50- }
48+ type = " SecureString"
49+ value = var. api_key
50+ }
51+
52+ # Log group
53+ resource "aws_cloudwatch_log_group" "cw_log_group" {
54+ name = " /aws/batch/job/${ var . prefix } -input/"
55+ }
0 commit comments