From 9ae8e85640f4a3f5faeb94ff7f96236b46758ba2 Mon Sep 17 00:00:00 2001 From: clint shryock Date: Mon, 21 Mar 2016 11:39:51 -0500 Subject: [PATCH 1/8] provider/aws: Fix crasher in Elastic Beanstalk Configuration with option settings --- ...lastic_beanstalk_configuration_template.go | 30 ++------- ...c_beanstalk_configuration_template_test.go | 64 +++++++++++++++++++ ...stalk_configuration_template.html.markdown | 12 +++- 3 files changed, 79 insertions(+), 27 deletions(-) diff --git a/builtin/providers/aws/resource_aws_elastic_beanstalk_configuration_template.go b/builtin/providers/aws/resource_aws_elastic_beanstalk_configuration_template.go index eff6535e94..1f3f91e84b 100644 --- a/builtin/providers/aws/resource_aws_elastic_beanstalk_configuration_template.go +++ b/builtin/providers/aws/resource_aws_elastic_beanstalk_configuration_template.go @@ -4,7 +4,6 @@ import ( "fmt" "log" - "github.com/hashicorp/terraform/helper/hashcode" "github.com/hashicorp/terraform/helper/schema" "github.com/aws/aws-sdk-go/aws" @@ -38,26 +37,12 @@ func resourceAwsElasticBeanstalkConfigurationTemplate() *schema.Resource { Optional: true, ForceNew: true, }, - "option_settings": &schema.Schema{ + "setting": &schema.Schema{ Type: schema.TypeSet, Optional: true, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "namespace": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - }, - "option_name": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - }, - "value": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - }, - }, - }, - Set: optionSettingHash, + Computed: true, + Elem: resourceAwsElasticBeanstalkOptionSetting(), + Set: optionSettingValueHash, }, "solution_stack_name": &schema.Schema{ Type: schema.TypeString, @@ -225,13 +210,6 @@ func resourceAwsElasticBeanstalkConfigurationTemplateDelete(d *schema.ResourceDa return err } -func optionSettingHash(v interface{}) int { - rd := v.(*schema.ResourceData) - namespace := rd.Get("namespace").(string) - optionName := rd.Get("option_name").(string) - return hashcode.String(fmt.Sprintf("%s.%s", namespace, optionName)) -} - func gatherOptionSettings(d *schema.ResourceData) []*elasticbeanstalk.ConfigurationOptionSetting { optionSettingsSet, ok := d.Get("option_settings").(*schema.Set) if !ok || optionSettingsSet == nil { diff --git a/builtin/providers/aws/resource_aws_elastic_beanstalk_configuration_template_test.go b/builtin/providers/aws/resource_aws_elastic_beanstalk_configuration_template_test.go index 0d0ec4c0af..4aedf82b15 100644 --- a/builtin/providers/aws/resource_aws_elastic_beanstalk_configuration_template_test.go +++ b/builtin/providers/aws/resource_aws_elastic_beanstalk_configuration_template_test.go @@ -7,6 +7,7 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/service/elasticbeanstalk" + "github.com/hashicorp/terraform/helper/acctest" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/terraform" ) @@ -29,6 +30,24 @@ func TestAccAWSBeanstalkConfigurationTemplate_basic(t *testing.T) { }) } +func TestAccAWSBeanstalkConfigurationTemplate_VPC(t *testing.T) { + var config elasticbeanstalk.ConfigurationSettingsDescription + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckBeanstalkConfigurationTemplateDestroy, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: testAccBeanstalkConfigurationTemplateConfig_VPC(acctest.RandString(5)), + Check: resource.ComposeTestCheckFunc( + testAccCheckBeanstalkConfigurationTemplateExists("aws_elastic_beanstalk_configuration_template.tf_template", &config), + ), + }, + }, + }) +} + func testAccCheckBeanstalkConfigurationTemplateDestroy(s *terraform.State) error { conn := testAccProvider.Meta().(*AWSClient).elasticbeanstalkconn @@ -119,3 +138,48 @@ resource "aws_elastic_beanstalk_configuration_template" "tf_template" { solution_stack_name = "64bit Amazon Linux 2015.09 v2.0.8 running Go 1.4" } ` + +func testAccBeanstalkConfigurationTemplateConfig_VPC(name string) string { + return fmt.Sprintf(` +resource "aws_vpc" "tf_b_test" { + cidr_block = "10.0.0.0/16" + + tags { + Name = "beanstalk_crash" + } +} + +resource "aws_subnet" "main" { + vpc_id = "${aws_vpc.tf_b_test.id}" + cidr_block = "10.0.0.0/24" + + tags { + Name = "subnet-count-test" + } +} + +resource "aws_elastic_beanstalk_application" "tftest" { + name = "tf-test-%s" + description = "tf-test-desc" +} + +resource "aws_elastic_beanstalk_configuration_template" "tf_template" { + name = "tf-test-%s" + application = "${aws_elastic_beanstalk_application.tftest.name}" + + solution_stack_name = "64bit Amazon Linux 2015.03 v2.0.3 running Go 1.4" + + setting { + namespace = "aws:ec2:vpc" + name = "VPCId" + value = "${aws_vpc.tf_b_test.id}" + } + + setting { + namespace = "aws:ec2:vpc" + name = "Subnets" + value = "${aws_subnet.main.id}" + } +} +`, name, name) +} diff --git a/website/source/docs/providers/aws/r/elastic_beanstalk_configuration_template.html.markdown b/website/source/docs/providers/aws/r/elastic_beanstalk_configuration_template.html.markdown index 02d0be496c..a493f58ff4 100644 --- a/website/source/docs/providers/aws/r/elastic_beanstalk_configuration_template.html.markdown +++ b/website/source/docs/providers/aws/r/elastic_beanstalk_configuration_template.html.markdown @@ -36,13 +36,23 @@ The following arguments are supported: * `application` – (Required) name of the application to associate with this configuration template * `description` - (Optional) Short description of the Template * `environment_id` – (Optional) The ID of the environment used with this configuration template -* `option_settings` – (Optional) Option settings to configure the new Environment. These +* `setting` – (Optional) Option settings to configure the new Environment. These override specific values that are set as defaults. The format is detailed below in [Option Settings](#option-settings) * `solution_stack_name` – (Optional) A solution stack to base your Template off of. Example stacks can be found in the [Amazon API documentation][1] + +## Option Settings + +The `setting` field supports the following format: + +* `namespace` - (Optional) unique namespace identifying the option's + associated AWS resource +* `name` - (Optional) name of the configuration option +* `value` - (Optional) value for the configuration option + ## Attributes Reference The following attributes are exported: From 972aecdd84283526241c2bfc7830fd52918236da Mon Sep 17 00:00:00 2001 From: Bill Fumerola Date: Mon, 21 Mar 2016 10:21:57 -0700 Subject: [PATCH 2/8] Correct markdown for google_compute_instance_group and attach to index --- .../r/compute_instance_group.html.markdown | 21 ++++++++----------- website/source/layouts/google.erb | 4 ++++ 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/website/source/docs/providers/google/r/compute_instance_group.html.markdown b/website/source/docs/providers/google/r/compute_instance_group.html.markdown index 00dd06c70e..adfb597fc0 100644 --- a/website/source/docs/providers/google/r/compute_instance_group.html.markdown +++ b/website/source/docs/providers/google/r/compute_instance_group.html.markdown @@ -15,24 +15,24 @@ and [API](https://cloud.google.com/compute/docs/reference/latest/instanceGroups) ## Example Usage -Empty instance group +### Empty instance group ``` -resource "google_compute_instance_group" "foobar" { +resource "google_compute_instance_group" "test" { name = "terraform-test" description = "Terraform test instance group" zone = "us-central1-a" } ``` -With instances and named ports +### With instances and named ports ``` -resource "google_compute_instance_group" "foobar" { - name = "terraform-test" +resource "google_compute_instance_group" "webservers" { + name = "terraform-webservers" description = "Terraform test instance group" - instances = [ - "${google_compute_instance.test.self_link}", - "${google_compute_instance.test2.self_link}" - ] + instances = [ + "${google_compute_instance.test.self_link}", + "${google_compute_instance.test2.self_link}" + ] named_port { name = "http" port = "8080" @@ -70,7 +70,6 @@ Supported characters include lowercase letters, numbers, and hyphens. The `named_port` block supports: * `name` - The name which the port will be mapped to. - * `port` - The port number to map the name to. ## Attributes Reference @@ -78,7 +77,5 @@ The `named_port` block supports: The following attributes are exported: * `network` - The network the instance group is in. - * `size` - The number of instances in the group. - * `self_link` - The URL of the created resource. diff --git a/website/source/layouts/google.erb b/website/source/layouts/google.erb index 1a0638645b..4940044587 100644 --- a/website/source/layouts/google.erb +++ b/website/source/layouts/google.erb @@ -57,6 +57,10 @@ google_compute_instance + > + google_compute_instance_group + + > google_compute_instance_group_manager From e62580e7e7471e277dc3ebe331206bfc36f90851 Mon Sep 17 00:00:00 2001 From: Clint Date: Mon, 21 Mar 2016 12:59:53 -0500 Subject: [PATCH 3/8] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ca81c083b4..726b2df908 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,7 @@ BUG FIXES: * provider/aws: `aws_cloudformation_stack` use `timeout_in_minutes` for retry timeout to prevent unecessary timeouts [GH-5712] * provider/aws: `aws_lambda_function` resources no longer error on refresh if deleted externally to Terraform [GH-5668] * provider/aws: `aws_vpn_connection` resources deleted via the console on longer cause a crash [GH-5747] + * provider/aws: Fix crasher in Elastic Beanstalk Configuration when using options [GH-756] * provider/digitalocean: `digitalocean_ssh_key` resources no longer cause a panic if there is no network connectivity [GH-5748] * provider/google: Default description `google_dns_managed_zone` resources to "Managed By Terraform" [GH-5428] * provider/google: Fix error message on invalid instance URL for `google_compute_instance_group` [GH-5715] From f7ef36b86d877d42368c1dff38bf8328e52b46ed Mon Sep 17 00:00:00 2001 From: Clint Date: Mon, 21 Mar 2016 13:00:32 -0500 Subject: [PATCH 4/8] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 726b2df908..333cc5680c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,7 +26,7 @@ BUG FIXES: * provider/aws: `aws_cloudformation_stack` use `timeout_in_minutes` for retry timeout to prevent unecessary timeouts [GH-5712] * provider/aws: `aws_lambda_function` resources no longer error on refresh if deleted externally to Terraform [GH-5668] * provider/aws: `aws_vpn_connection` resources deleted via the console on longer cause a crash [GH-5747] - * provider/aws: Fix crasher in Elastic Beanstalk Configuration when using options [GH-756] + * provider/aws: Fix crasher in Elastic Beanstalk Configuration when using options [GH-5756] * provider/digitalocean: `digitalocean_ssh_key` resources no longer cause a panic if there is no network connectivity [GH-5748] * provider/google: Default description `google_dns_managed_zone` resources to "Managed By Terraform" [GH-5428] * provider/google: Fix error message on invalid instance URL for `google_compute_instance_group` [GH-5715] From f46a629d7214abe860a8c4eb2a527e07c41f8840 Mon Sep 17 00:00:00 2001 From: David Meyer Date: Mon, 21 Mar 2016 12:12:45 -0500 Subject: [PATCH 5/8] communicator/winrm: Fixed HTTPS when using copy client. --- communicator/winrm/communicator.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/communicator/winrm/communicator.go b/communicator/winrm/communicator.go index 30998e0b14..177efdcb9c 100644 --- a/communicator/winrm/communicator.go +++ b/communicator/winrm/communicator.go @@ -193,12 +193,21 @@ func (c *Communicator) UploadDir(dst string, src string) error { func (c *Communicator) newCopyClient() (*winrmcp.Winrmcp, error) { addr := fmt.Sprintf("%s:%d", c.endpoint.Host, c.endpoint.Port) - return winrmcp.New(addr, &winrmcp.Config{ + + config := winrmcp.Config{ Auth: winrmcp.Auth{ User: c.connInfo.User, Password: c.connInfo.Password, }, + Https: c.connInfo.HTTPS, + Insecure: c.connInfo.Insecure, OperationTimeout: c.Timeout(), MaxOperationsPerShell: 15, // lowest common denominator - }) + } + + if c.connInfo.CACert != nil { + config.CACertBytes = *c.connInfo.CACert + } + + return winrmcp.New(addr, &config) } From f64854840c5a4731eb98aa081c525bd224a96b82 Mon Sep 17 00:00:00 2001 From: James Nugent Date: Mon, 21 Mar 2016 18:20:31 +0000 Subject: [PATCH 6/8] Update CHANGELOG.md --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 333cc5680c..42c0a6a094 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,8 @@ FEATURES: IMPROVEMENTS: - * provider/aws: `aws_cloudwatch_log_group` now performs validation on `name` [GH-5444] + * core: provisioners connecting via WinRM now respect HTTPS settings [GH-5761] + * provider/aws: `aws_db_instance` now makes `identifier` optional and generates a unique ID when it is omitted [GH-5723] * provider/aws: `aws_db_instance` now makes `identifier` optional and generates a unique ID when it is omitted [GH-5723] * provider/aws: `aws_redshift_cluster` now allows`publicly_accessible` to be modified [GH-5721] From 910a7fca98b83ba46c4745a610f0aa2af39f9e47 Mon Sep 17 00:00:00 2001 From: James Nugent Date: Mon, 21 Mar 2016 18:23:03 +0000 Subject: [PATCH 7/8] Update CHANGELOG.md --- CHANGELOG.md | 1 - 1 file changed, 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 42c0a6a094..aeae9bed32 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,7 +13,6 @@ IMPROVEMENTS: * core: provisioners connecting via WinRM now respect HTTPS settings [GH-5761] * provider/aws: `aws_db_instance` now makes `identifier` optional and generates a unique ID when it is omitted [GH-5723] - * provider/aws: `aws_db_instance` now makes `identifier` optional and generates a unique ID when it is omitted [GH-5723] * provider/aws: `aws_redshift_cluster` now allows`publicly_accessible` to be modified [GH-5721] BUG FIXES: From d38ee000391d6fb2e04916d54d1f70181237bcb7 Mon Sep 17 00:00:00 2001 From: Paul Hinze Date: Mon, 21 Mar 2016 13:35:07 -0500 Subject: [PATCH 8/8] travis: switch to unencrypted cookie Otherwise rate limiting fix does not work for PRs from forks --- .travis.yml | 3 --- scripts/gogetcookie.sh | 10 ++++++++++ scripts/gogetcookie.sh.enc | Bin 400 -> 0 bytes 3 files changed, 10 insertions(+), 3 deletions(-) create mode 100755 scripts/gogetcookie.sh delete mode 100644 scripts/gogetcookie.sh.enc diff --git a/.travis.yml b/.travis.yml index dddd9b111c..6d1fc02d51 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,9 +2,6 @@ sudo: false language: go go: - 1.6 -before_install: -- openssl aes-256-cbc -K $encrypted_409871ff96c7_key -iv $encrypted_409871ff96c7_iv - -in scripts/gogetcookie.sh.enc -out scripts/gogetcookie.sh -d install: # This script is used by the Travis build to install a cookie for # go.googlesource.com so rate limits are higher when using `go get` to fetch diff --git a/scripts/gogetcookie.sh b/scripts/gogetcookie.sh new file mode 100755 index 0000000000..26c63a64be --- /dev/null +++ b/scripts/gogetcookie.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +touch ~/.gitcookies +chmod 0600 ~/.gitcookies + +git config --global http.cookiefile ~/.gitcookies + +tr , \\t <<\__END__ >>~/.gitcookies +.googlesource.com,TRUE,/,TRUE,2147483647,o,git-paul.hashicorp.com=1/z7s05EYPudQ9qoe6dMVfmAVwgZopEkZBb1a2mA5QtHE +__END__ diff --git a/scripts/gogetcookie.sh.enc b/scripts/gogetcookie.sh.enc deleted file mode 100644 index 5e0b1870a127c6af59fc32cbeca7e2476b87ae12..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 400 zcmV;B0dM|utN++++TFZ3F2t|nSs}J!@mhn#7FualyVLlbACWKnA3q0cuK}|ruEsq` zre&|U`*|`6Z0p*+l!ilfd+Nb}<$zC107=$LACMajOAwpARPn}wD<db0TtiME+TE#(1DbqU1==@_yVEWK@>V)r2t1 zh;i41ctcghHnnscrFdbxwCyotofSUMVpKP@mfxv@Yk2bJbCW*b)uGvNMv_$x=_^g? z$n#kF`<9`my=Do;>H#B@DOyK4mC9ZhG4f=FmNz>-iawn-&@Hvq3MQ=YakA9`-_eCU ud0VpmcNKxv<1dD7Irzm5`!Y`cAja