ingenieux/beanstalker

create-environment and replace-environment goals always deploy to default region

Closed this issue · 5 comments

I'm trying to use the beanstalk-maven-plugin v1.4.0 to deploy an application to us-west-2. Here's an excerpt from my pom.xml:

<plugin>
    <groupId>br.com.ingenieux</groupId>
    <artifactId>beanstalk-maven-plugin</artifactId>
    <version>1.4.0</version>
    <configuration>
        <!-- the ELB Application/Environment to update -->
        <applicationName>My Application</applicationName>
        <environmentName>application-environment-name</environmentName>
        <region>us-west-2</region>
        <s3Region>us-west-2</s3Region>
        <cnamePrefix>application-environment-name2</cnamePrefix>

        <!-- the artifact to upload -->
        <artifactFile>${project.build.directory}/${project.build.finalName}.zip</artifactFile>

        <!-- the S3 location to upload the artifact to -->
        <s3Bucket>my-s3-bucket</s3Bucket>
        <s3Key>${project.build.finalName}.zip</s3Key>

        <!-- the name to give to this version of the application -->
        <versionLabel>${project.build.finalName}</versionLabel>
    </configuration>
    <executions>
        <!-- hook on the mvn deploy task -->
        <execution>
            <phase>deploy</phase>
            <goals>
                <goal>upload-source-bundle</goal>
                <goal>create-application-version</goal>
                <goal>create-environment</goal>
            </goals>
        </execution>
    </executions>
</plugin>

When I run mvn clean deploy, everything succeeds as expected, except that the application is created in the us-east-1 region, instead of the us-west-2 region as specified in the config. The same problem occurs when I switch the create-environment goal out for replace-environment.

How do I override the default us-east-1 region with a region of my choice?

See #69 and run mvn -X with your output please

After a lot more experimentation, I think the solution is to put the environment and region configuration values into my pom file's properties block:

<properties>
    <!-- these config values describe where our application lives in ELB so that the beanstalk-maven-plugin can find it -->
    <beanstalk.applicationName>My Application</beanstalk.applicationName>
    <beanstalk.environmentRef>${artifactId}-dev.elasticbeanstalk.com</beanstalk.environmentRef>
    <beanstalk.environmentName>${artifactId}-dev</beanstalk.environmentName>
    <beanstalker.region>us-west-2</beanstalker.region>
</properties>

I'm not clear on why, but doing so seems to fix the problem. Is this as designed? I would expect to be able to put these properties in the plugin's configuration block without their beanstalk and beanstalker prefixes.

It actually is as designed :)

-- Aldrin Leal, aldrin@leal.eng.br / http://about.me/aldrinleal

On Tue, Dec 22, 2015 at 4:21 PM, Jonathan notifications@github.com wrote:

After a lot more experimentation, I think the solution is to put the
environment and region configuration values into my pom file's properties
block:

My Application ${artifactId}-dev.elasticbeanstalk.com ${artifactId}-dev us-west-2

I'm not clear on why, but doing so seems to fix the problem. Is this as
designed? I would expect to be able to put these properties in the plugin's
configuration block without their beanstalk and beanstalker prefixes.


Reply to this email directly or view it on GitHub
#79 (comment)
.

If that's the case, can I suggest that this be more clearly documented? It seems like a pretty big gotcha that a lot of users of the plugin might run into.

Since I'm only using the plugin for one phase of my build process, I'd prefer to keep its configuration in one spot, rather than splitting it between the global properties block and the plugin's own configuration block, but if I must do so, then that's ok, as long as the requirement is clearly documented.