- Newest
- Most votes
- Most comments
The issue you're experiencing with your CodePipeline CloudFormation template is likely due to how the Subnets and SecurityGroupIds are being referenced. When using the Commands provider in CodePipeline, these values need to be provided as comma-separated strings, not as lists.
To resolve this, you can modify your template to use the Join function to convert the list outputs into comma-separated strings. Here's how you can adjust your template:
- Name: push-tag ActionTypeId: Category: Compute Owner: AWS Provider: Commands Version: '1' Commands: - git tag release ${CODEBUILD_RESOLVED_SOURCE_VERSION} - git push --force origin --tags Configuration: VpcId: !GetAtt BuildVpc.VpcId Subnets: !Join [',', !GetAtt BuildVpc.Subnets] SecurityGroupIds: !Join [',', !Ref BuildSecurityGroup] InputArtifacts: - Name: sources RunOrder: 1
In this modified version, we're using the !Join function to concatenate the subnet IDs and security group IDs into comma-separated strings. This should resolve the issue with invalid subnets and security groups in your CodePipeline action.
Remember that when using the Commands provider, you need to ensure that your pipeline's service role has the necessary permissions to execute these commands and access the specified VPC resources.
Sources
Commands action reference - AWS CodePipeline
AWS::CodePipeline::Pipeline ActionDeclaration - AWS CloudFormation
Relevant content
- asked 6 years ago
- AWS OFFICIALUpdated 6 months ago
It still does not have provision to add EnvironmentVariables using cloudformation.