I am trying to use troposphere to make a cloudformation template. The stack the template makes intended to be a simple example of codedeploy
I have previously got troposphere to generate ec2, s3, iam and route53 generating templates. I have previously made codedeploy work with the GUI AWS Console
I am encountering an error and I don't see why
Here is my troposphere program
from troposphere import Template
from troposphere.codedeploy import Application, DeploymentConfig, DeploymentGroup, MinimumHealthyHosts, S3Location
#1
#CreateApplication with an applicationName
app=Application( 'test123')
#2
#CreateDeploymentConfig
config=DeploymentConfig('config123',
MinimumHealthyHosts=MinimumHealthyHosts( Type='HOST_COUNT', Value=1 )
)
#3
#CreateDeploymentGroup using applicationName as input
#and deploymentConfigName
depgroup=DeploymentGroup("depgroup123",
ApplicationName='test123',
DeploymentConfigName='config123',
ServiceRoleArn='arn:aws:iam::930517348825:role/isCompatibleWithAWSCodeDeploy')
)
t = Template()
t.add_description(
"""
Test of making a code deploy setup from a template
""")
t.add_resource(app)
t.add_resource(config)
t.add_resource(depgroup)
print(t.to_json())
Here is the Cloudformation template it makes
{
"Description": "\nTest of making a code deploy setup from a template\n",
"Resources": {
"config123": {
"Properties": {
"MinimumHealthyHosts": {
"Type": "HOST_COUNT",
"Value": 1
}
},
"Type": "AWS::CodeDeploy::DeploymentConfig"
},
"depgroup123": {
"Properties": {
"ApplicationName": "test123",
"DeploymentConfigName": "config123",
"ServiceRoleArn": "arn:aws:iam::930517348825:role/isCompatibleWithAWSCodeDeploy"
},
"Type": "AWS::CodeDeploy::DeploymentGroup"
},
"test123": {
"Type": "AWS::CodeDeploy::Application"
}
}
}
When I load the template into the cloudformation GUI this occurs before roll back
09:08:50 UTC+0000 CREATE_FAILED AWS::CodeDeploy::DeploymentConfig config123 Resource creation cancelled
09:08:48 UTC+0000 CREATE_IN_PROGRESS AWS::CodeDeploy::DeploymentConfig config123
09:08:48 UTC+0000 CREATE_FAILED AWS::CodeDeploy::DeploymentGroup depgroup123 No application found for name: test123
09:08:47 UTC+0000 CREATE_COMPLETE AWS::CodeDeploy::Application test123
What I don't understand is that the stack has created the AWS::CodeDeploy::Application "test123" but then the next message says "No application found for name: test123"
role/isCompatibleWithAWSCodeDeploy already exists.
Do I need to add anything else?