I've a template.yaml (in root folder), and ecs_job_definitions.yaml and a ecs_job_definitions.yaml files inside "nested-stack-templates" folder
In the template.yaml file I want to refer to my ecs_job_definitions.yaml
Resources:
ECSJobDefinitionsStack:
Type: AWS::CloudFormation::Stack
Properties:
TemplateURL: 'nested-stack-templates/ecs_job_definitions.yaml'
Parameters:
SesToAddress: !Ref SesToAddress
DockerImageURIForDashboard: !Ref DockerImageURIForDashboard
JobDefinitionVcpuReservation: !Ref JobDefinitionVcpuReservation
JobDefinitionMemoryReservation: !Ref JobDefinitionMemoryReservation
SesIdentityArn: !Ref SesIdentityArn
SesFromAddress: !Ref SesFromAddress
BaseURLForUat: !Ref BaseURLForUat
EnvName: !Ref EnvName
MyECSTaskExecutionRole: !Ref MyECSTaskExecutionRole
MyECSTaskRole: !Ref MyECSTaskRole
AppNameForResources: !Ref AppNameForResources
Outputs:
MyECSTaskExecutionRole:
Value: !GetAtt ECSTaskExecutionRole.Arn
MyECSTaskRole:
Value: !GetAtt ECSTaskRole.Arn
MySecrets:
Value: !Ref MyLittleSecretA
MyECSLogGroup:
Value: !Ref ECSLogGroup
In my ecs_job_definitions.yaml I have this:
Resources:
AWSBatchJobDefinitionForDashboardApi:
Type: AWS::Batch::JobDefinition
Properties:
JobDefinitionName:
!Sub
- "${TheAppNameForResources}-${TheEnvName}-jd-dashboard"
- TheAppNameForResources: !Ref AppNameForResources
TheEnvName: !Ref EnvName
PlatformCapabilities:
- FARGATE
PropagateTags: true
RetryStrategy:
Attempts: 1
Type: container
ContainerProperties:
Environment:
- Name: SES_IDENTITY_ARN
Value: !Ref SesIdentityArn
- Name: SES_FROM_ADDRESS
Value: !Ref SesFromAddress
- Name: SES_TO_ADDRESS
Value: !Ref SesToAddress
- Name: BASE_URL_FOR_UAT
Value: !Ref BaseURLForUat
- Name: CITCO_ENV
Value: !Ref EnvName
ExecutionRoleArn: !Ref MyCollateralECSTaskExecutionRole
FargatePlatformConfiguration:
PlatformVersion: LATEST
Image: !Ref DockerImageURIForDashboard
JobRoleArn: !Ref MyECSTaskRole
LogConfiguration:
LogDriver: awslogs
NetworkConfiguration:
AssignPublicIp: DISABLED
ResourceRequirements:
- Type: MEMORY
Value: !Ref JobDefinitionMemoryReservation
- Type: VCPU
Value: !Ref JobDefinitionVcpuReservation
There are many AWS::Batch::JobDefinition so I want to isolate them under "ecs_job_definitions.yaml" and refer this from template.yaml
When doing so I also need the corresponding roles for ecs job definitions to be attached in AWS::Batch::JobDefinition, so I've the Output section in template.yaml file.
But I don't know how to refer this in my "ecs_job_definitions.yaml" file. Any help is much appreciated.
I don't intent to Export these values, just refer them in my nested stack.