Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Elastic Beanstalk support for PlatformArn #6093

Merged

Conversation

jbienkowski311
Copy link
Contributor

@jbienkowski311 jbienkowski311 commented Oct 8, 2018

If you are using AWS's ready to use solutions stacks, then you are fine. But if for some reason you would like to use AWS Custom Platform, then Terraform will not support it.
This PR adds support for CloudFormation's parameter PlatformArn, therefore adding support for Custom Platforms to Terraform.

Changes proposed in this pull request:

  • Add support for platform_arn parameter to Elastic Beanstalk Environment resource. More about PlatformArn can be found in AWS Docs

Output from acceptance testing:

$ make testacc TESTARGS='-run=TestAccAWSBeanstalkEnv_platformArn'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./... -v -run=TestAccAWSBeanstalkEnv_platformArn -timeout 120m
?   	github.com/terraform-providers/terraform-provider-aws	[no test files]
=== RUN   TestAccAWSBeanstalkEnv_platformArn
--- PASS: TestAccAWSBeanstalkEnv_platformArn (494.89s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	494.914s

@ghost ghost added size/M Managed by automation to categorize the size of a PR. documentation Introduces or discusses updates to documentation. service/elasticbeanstalk Issues and PRs that pertain to the elasticbeanstalk service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. labels Oct 8, 2018
Copy link
Contributor

@bflad bflad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @jbienkowski311 👋 Thanks for submitting this! A few minor little things then this should be good to go -- please let us know if you have any questions or do not have time to implement the feedback.

Config: testAccBeanstalkEnvConfig_platform_arn(appName, envName, platformArn),
Check: resource.ComposeTestCheckFunc(
testAccCheckBeanstalkEnvExists("aws_elastic_beanstalk_environment.tfenvtest", &app),
resource.TestMatchResourceAttr(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be simplified to:

resource.TestCheckResourceAttr("aws_elastic_beanstalk_environment.tfenvtest", "platform_arn", platformArn),

name = "%s"
application = "${aws_elastic_beanstalk_application.tftest.name}"
platform_arn = "%s"
depends_on = ["aws_elastic_beanstalk_application.tftest"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two nits:

  • The formatting seems a bit off here (maybe spaces vs tabs?)
  • The depends_on is unnecessary as its already explicitly declared by aws_elastic_beanstalk_application.tftest.name

@bflad bflad added the waiting-response Maintainers are waiting on response from community or contributor. label Oct 8, 2018
@jbienkowski311
Copy link
Contributor Author

jbienkowski311 commented Oct 8, 2018

Hi @bflad 👋 Thanks for the review. I think I have fixed all the pointed out issues. The test still passes 😉

$ make testacc TESTARGS='-run=TestAccAWSBeanstalkEnv_platformArn'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./... -v -run=TestAccAWSBeanstalkEnv_platformArn -timeout 120m
?   	github.com/terraform-providers/terraform-provider-aws	[no test files]
=== RUN   TestAccAWSBeanstalkEnv_platformArn
--- PASS: TestAccAWSBeanstalkEnv_platformArn (486.35s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	486.373s

@bflad bflad removed the waiting-response Maintainers are waiting on response from community or contributor. label Oct 8, 2018
@bflad
Copy link
Contributor

bflad commented Oct 8, 2018

Yay! Thats great news, although it looks like AWS will automatically fill in PlatformArn when defining the environment in other ways, e.g.

--- FAIL: TestAccAWSBeanstalkEnv_basic_settings_update (409.34s)
    testing.go:527: Step 0 error: After applying this step, the plan was not empty:
        
        DIFF:
        
        UPDATE: aws_elastic_beanstalk_environment.tfenvtest
          platform_arn: "arn:aws:elasticbeanstalk:us-west-2::platform/Python 2.6 running on 64bit Amazon Linux/0.1.0" => ""

My recommendation would be to add Computed: true to the platform_arn in this case, which is safe since the attribute conflicts with the other attributes. 👍

@jbienkowski311
Copy link
Contributor Author

Hi @bflad, I have rerun the whole TestAccAWSBeanstalkEnv_ test suite. One test seems to be broken, not sure if I should fix it or not - let me know. Also the output is in batches, because I have hit the timeout of 2hours...

$ make testacc TEST=./aws TESTARGS='-run=TestAccAWSBeanstalkEnv_'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -run=TestAccAWSBeanstalkEnv_ -timeout 120m
=== RUN   TestAccAWSBeanstalkEnv_basic
--- PASS: TestAccAWSBeanstalkEnv_basic (509.68s)
=== RUN   TestAccAWSBeanstalkEnv_tier
--- PASS: TestAccAWSBeanstalkEnv_tier (639.01s)
=== RUN   TestAccAWSBeanstalkEnv_outputs
--- PASS: TestAccAWSBeanstalkEnv_outputs (476.72s)
=== RUN   TestAccAWSBeanstalkEnv_cname_prefix
--- PASS: TestAccAWSBeanstalkEnv_cname_prefix (546.04s)
=== RUN   TestAccAWSBeanstalkEnv_config
--- PASS: TestAccAWSBeanstalkEnv_config (634.75s)
=== RUN   TestAccAWSBeanstalkEnv_resource
--- PASS: TestAccAWSBeanstalkEnv_resource (688.12s)
=== RUN   TestAccAWSBeanstalkEnv_tags
--- PASS: TestAccAWSBeanstalkEnv_tags (931.26s)
=== RUN   TestAccAWSBeanstalkEnv_vpc
--- PASS: TestAccAWSBeanstalkEnv_vpc (585.39s)
=== RUN   TestAccAWSBeanstalkEnv_template_change
--- FAIL: TestAccAWSBeanstalkEnv_template_change (425.34s)
    testing.go:527: Step 0 error: Error applying: 1 error occurred:
        	* aws_elastic_beanstalk_configuration_template.template: 1 error occurred:
        	* aws_elastic_beanstalk_configuration_template.template: Error creating Elastic Beanstalk configuration template: InvalidParameterValue: No Solution Stack named '64bit Amazon Linux 2016.03 v2.1.3 running Go 1.5' found.
        	status code: 400, request id: 3b60019f-fbdb-40ea-9379-86c7c26cca91      
=== RUN   TestAccAWSBeanstalkEnv_basic_settings_update
--- PASS: TestAccAWSBeanstalkEnv_basic_settings_update (794.85s)
=== RUN   TestAccAWSBeanstalkEnv_version_label
--- PASS: TestAccAWSBeanstalkEnv_version_label (699.70s)
=== RUN   TestAccAWSBeanstalkEnv_settingWithJsonValue
panic: test timed out after 2h0m0s

$ make testacc TEST=./aws TESTARGS='-run=TestAccAWSBeanstalkEnv_platformArn'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -run=TestAccAWSBeanstalkEnv_platformArn -timeout 120m
=== RUN   TestAccAWSBeanstalkEnv_platformArn
--- PASS: TestAccAWSBeanstalkEnv_platformArn (471.23s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	471.255s

$ make testacc TEST=./aws TESTARGS='-run=TestAccAWSBeanstalkEnv_settingWithJsonValue'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -run=TestAccAWSBeanstalkEnv_settingWithJsonValue -timeout 120m
=== RUN   TestAccAWSBeanstalkEnv_settingWithJsonValue
--- PASS: TestAccAWSBeanstalkEnv_settingWithJsonValue (506.60s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	506.622s

@bflad
Copy link
Contributor

bflad commented Oct 9, 2018

Regarding hitting the acceptance testing timeout, once Terraform 0.11.9 is tagged and released, I will pull in the dependency and implement #5874

In the meantime, you can temporarily (we don't want to mess up the above process) add t.Parallel() to each of the acceptance testing functions as necessary and then remove that before committing. It will default -parallel to the number of CPUs but we normally run our CI server with 20 parallelism just fine. 😄

@jbienkowski311
Copy link
Contributor Author

Regarding hitting the acceptance testing timeout, once Terraform 0.11.9 is tagged and released, I will pull in the dependency and implement #5874

In the meantime, you can temporarily (we don't want to mess up the above process) add t.Parallel() to each of the acceptance testing functions as necessary and then remove that before committing. It will default -parallel to the number of CPUs but we normally run our CI server with 20 parallelism just fine.

Sounds good to me! What about the failing test? Should I fix it as well, or is it out of the scope for this PR? Maybe you can confirm that it is failing for you as well (maybe my AWS account/credentials are misconfigured)?

@bflad
Copy link
Contributor

bflad commented Oct 9, 2018

Interestingly enough that test passes in our CI environment with AWS_DEFAULT_REGION set to us-west-2 -- feel free to take a look if you wish, but shouldn't be an issue for merging this PR. I'm working on running the tests now.

@jbienkowski311
Copy link
Contributor Author

I used AWS_DEFAULT_REGION set to us-east-1 and it was failing, so maybe that's why.

@bflad bflad added this to the v1.40.0 milestone Oct 9, 2018
Copy link
Contributor

@bflad bflad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks @jbienkowski311! 🚀

@bflad bflad merged commit 2e4d7b7 into hashicorp:master Oct 9, 2018
bflad added a commit that referenced this pull request Oct 9, 2018
@jbienkowski311 jbienkowski311 deleted the elastic-beanstalk-support-platform-arn branch October 9, 2018 16:40
@bflad
Copy link
Contributor

bflad commented Oct 10, 2018

This has been released in version 1.40.0 of the AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

@ghost
Copy link

ghost commented Apr 2, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked and limited conversation to collaborators Apr 2, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Introduces or discusses updates to documentation. service/elasticbeanstalk Issues and PRs that pertain to the elasticbeanstalk service. size/M Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants