Merge branch 'master' of github.com:hashicorp/terraform

This commit is contained in:
stack72 2016-03-21 18:48:47 +00:00
commit fb92896326
10 changed files with 115 additions and 45 deletions

View File

@ -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

View File

@ -11,7 +11,7 @@ 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_redshift_cluster` now allows`publicly_accessible` to be modified [GH-5721]
@ -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-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]

View File

@ -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 {

View File

@ -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)
}

View File

@ -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)
}

10
scripts/gogetcookie.sh Executable file
View File

@ -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__

Binary file not shown.

View File

@ -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]
<a id="option-settings"></a>
## 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:

View File

@ -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.

View File

@ -57,6 +57,10 @@
<a href="/docs/providers/google/r/compute_instance.html">google_compute_instance</a>
</li>
<li<%= sidebar_current("docs-google-compute-instance-group") %>>
<a href="/docs/providers/google/r/compute_instance_group.html">google_compute_instance_group</a>
</li>
<li<%= sidebar_current("docs-google-compute-instance-group-manager") %>>
<a href="/docs/providers/google/r/compute_instance_group_manager.html">google_compute_instance_group_manager</a>
</li>