8000 CodeBuild Project Source Type Fails With "Ref" · Issue #940 · cloudtools/troposphere · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
CodeBuild Project Source Type Fails With "Ref" #940
Closed
@wesleywh

Description

@wesleywh

Troposphere Version: 2.1.2

Anytime I put a Ref in the Type of Source it will fail to validate with the following error:

Source Type: must be one of CODECOMMIT,CODEPIPELINE,GITHUB,S3

Here is my parameter:

template.add_parameter(Parameter(
        "SourceType",
        Type="String",
        AllowedValues=["CODECOMMIT", "CODEPIPELINE", "GITHUB", "BITBUCKET","S3"],
        Description="The type of repository that contains the source code to build.",
        ConstraintDescription="You must choose a valid value for SourceType."
    ))

Here is my CodeBuild Project definition (Note this is the one that fails):

template.add_resource(Project(
        "AMIBuilderProject",
        Description="Build AMI",
        Artifacts=Artifacts(Type='NO_ARTIFACTS'),                               #What codebuild outputs. (No binaries, images are saved not output)
        Environment=Environment(
            ComputeType=Ref("ComputeType"),                                     #the number of CPU cores and memory the build environment uses
            Image=Ref("Image"),
            Type="LINUX_CONTAINER",
            EnvironmentVariables=[
                {"Name":"AWS_REGION","Value":"us-west-2"},
            ]
        ),
        Name="AMIBuilder",                    #Name of the codebuild project
        ServiceRole=ImportValue(Sub("${CFCodeBuild}-project")),                 #Role codebuild uses to get things done
        TimeoutInMinutes=Ref("Timeout"),                                        #The number of minutes after which AWS CodeBuild stops the build if it's not complete.
        Tags=Tags(defaultTags),                                                 #Tags to apply to code build project (not propigated to AMIs)
        Source=Source(
                Type=Ref("SourceType"),                      #Type of this location
                Location=If("NoCodePipeline",Ref("SourceLocation"),Ref("AWS::NoValue")), #location of the source code in the specified repository type
                BuildSpec="Linux/test/buildspec.yml" #Codebuild build specification file
        )
    ))

This one works:

    template.add_resource(Project(
        "AMIBuilderProject",
        Description="Build AMI",
        Artifacts=Artifacts(Type='NO_ARTIFACTS'),                               #What codebuild outputs. (No binaries, images are saved not output)
        Environment=Environment(
            ComputeType=Ref("ComputeType"),                                     #the number of CPU cores and memory the build environment uses
            Image=Ref("Image"),
            Type="LINUX_CONTAINER",
            EnvironmentVariables=[
                {"Name":"AWS_REGION","Value":"us-west-2"},
            ]
        ),
        Name="AMIBuilder",                    #Name of the codebuild project
        ServiceRole=ImportValue(Sub("${CFCodeBuild}-project")),                 #Role codebuild uses to get things done
        TimeoutInMinutes=Ref("Timeout"),                                        #The number of minutes after which AWS CodeBuild stops the build if it's not complete.
        Tags=Tags(defaultTags),                                                 #Tags to apply to code build project (not propigated to AMIs)
        Source=Source(
                Type="CODECOMMIT",                      #Type of this location
                Location=If("NoCodePipeline",Ref("SourceLocation"),Ref("AWS::NoValue")), #location of the source code in the specified repository type
                BuildSpec="Linux/test/buildspec.yml" #Codebuild build specification file
        )
    ))

Notice the only difference between these 2 blocks is the Source Type. One is hard coded and the other uses the Ref

I do supply it CODECOMMIT in my parameter. I have tried this multiple times and checked for spelling errors. I have had others verify that everything looked correct as well so it's not a spelling error.

Am I missing something or is this a bug?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0