Skip to content

Commit

Permalink
merged origin/master
Browse files Browse the repository at this point in the history
  • Loading branch information
m-s-austin committed May 13, 2015
2 parents e14a1ad + c003e96 commit 233a5f4
Show file tree
Hide file tree
Showing 162 changed files with 3,725 additions and 384 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ website/build
website/node_modules
.vagrant/
*.backup
*.tfstate
./*.tfstate
.terraform/
*.log
*.bak
*~
Expand Down
47 changes: 44 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,43 @@
## 0.5.0 (unreleased)
## 0.5.1 (unreleased)

FEATURES:

* **Chef provisioning**: You can now provision new hosts (both Linux and
Windows) with [Chef](https://chef.io) using a native provisioner [GH-1868]

IMPROVEMENTS:

* provider/aws: `aws_s3_bucket` exports `hosted_zone_id` and `region` [GH-1865]
* provider/aws: `aws_route53_record` exports `fqdn` [GH-1847]
* provider/google: `google_compute_instance` `scratch` attribute added [GH-1920]
* **New config function: `formatlist`** - Format lists in a similar way to `format`.
Useful for creating URLs from a list of IPs. [GH-1829]

BUG FIXES:

* core: fix "resource not found" for interpolation issues with modules
* core: fix unflattenable error for orphans [GH-1922]
* command/push: local vars override remote ones [GH-1881]
* provider/aws: Mark `aws_security_group` description as `ForceNew` [GH-1871]
* provider/aws: `aws_db_instance` ARN value is correct [GH-1910]
* provider/aws: `aws_db_instance` only submit modify request if there
is a change. [GH-1906]
* provider/aws: `aws_security_group` + `aws_subnet` - destroy timeout increased
to prevent DependencyViolation errors. [GH-1886]
* provider/google: `google_compute_instance` Local SSDs no-longer cause crash
[GH-1088]
* provider/google: `google_http_health_check` Defaults now driven from Terraform,
avoids errors on update [GH-1894]
* provider/google: `google_compute_template` Update Instance Template network
definition to match changes to Instance [GH-980]
* provider/template: Fix infinite diff [GH-1898]

## 0.5.0 (May 7, 2015)

BACKWARDS INCOMPATIBILITIES:

* provider/aws: Terraform now remove the default egress rule created by AWS in
a new security group.

FEATURES:

Expand All @@ -15,6 +54,8 @@ FEATURES:
retry attempts is also configurable.
* **Templates**: A new `template_file` resource allows long strings needing
variable interpolation to be moved into files. [GH-1778]
* **Provision with WinRM**: Provisioners can now run remote commands on
Windows hosts. [GH-1483]

IMPROVEMENTS:

Expand Down Expand Up @@ -70,6 +111,8 @@ IMPROVEMENTS:
* provider/aws: `aws_elb` supports connection draining settings [GH-1502]
* provider/aws: `aws_elb` increase default idle timeout to 60s [GH-1646]
* provider/aws: `aws_key_pair` name can be omitted and generated [GH-1751]
* provider/aws: `aws_network_acl` improved validation for network ACL ports
and protocols [GH-1798] [GH-1808]
* provider/aws: `aws_route_table` can target network interfaces [GH-968]
* provider/aws: `aws_route_table` can specify propogating VGWs [GH-1516]
* provider/aws: `aws_route53_record` supports weighted sets [GH-1578]
Expand Down Expand Up @@ -763,5 +806,3 @@ BUG FIXES:
## 0.1.0 (July 28, 2014)

* Initial release


15 changes: 15 additions & 0 deletions builtin/bins/provisioner-chef/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package main

import (
"github.com/hashicorp/terraform/builtin/provisioners/chef"
"github.com/hashicorp/terraform/plugin"
"github.com/hashicorp/terraform/terraform"
)

func main() {
plugin.Serve(&plugin.ServeOpts{
ProvisionerFunc: func() terraform.ResourceProvisioner {
return new(chef.ResourceProvisioner)
},
})
}
1 change: 1 addition & 0 deletions builtin/bins/provisioner-chef/main_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package main
23 changes: 23 additions & 0 deletions builtin/providers/aws/hosted_zones.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package aws

// This list is copied from
// http://docs.aws.amazon.com/general/latest/gr/rande.html#s3_website_region_endpoints
// It currently cannot be generated from the API json.
var hostedZoneIDsMap = map[string]string{
"us-east-1": "Z3AQBSTGFYJSTF",
"us-west-2": "Z3BJ6K6RIION7M",
"us-west-1": "Z2F56UZL2M1ACD",
"eu-west-1": "Z1BKCTXD74EZPE",
"central-1": "Z21DNDUVLTQW6Q",
"ap-southeast-1": "Z3O0J2DXBE1FTB",
"ap-southeast-2": "Z1WCIGYICN2BYD",
"ap-northeast-1": "Z2M4EHUR26P7ZW",
"sa-east-1": "Z7KQH4QJS55SO",
"us-gov-west-1": "Z31GFT0UA1I2HV",
}

// Returns the hosted zone ID for an S3 website endpoint region. This can be
// used as input to the aws_route53_record resource's zone_id argument.
func HostedZoneIDForRegion(region string) string {
return hostedZoneIDsMap[region]
}
19 changes: 19 additions & 0 deletions builtin/providers/aws/hosted_zones_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package aws

import (
"testing"
)

func TestHostedZoneIDForRegion(t *testing.T) {
if r := HostedZoneIDForRegion("us-east-1"); r != "Z3AQBSTGFYJSTF" {
t.Fatalf("bad: %s", r)
}
if r := HostedZoneIDForRegion("ap-southeast-2"); r != "Z1WCIGYICN2BYD" {
t.Fatalf("bad: %s", r)
}

// Bad input should be empty string
if r := HostedZoneIDForRegion("not-a-region"); r != "" {
t.Fatalf("bad: %s", r)
}
}
31 changes: 31 additions & 0 deletions builtin/providers/aws/network_acl_entry.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package aws

import (
"fmt"
"net"
"strconv"

"github.com/awslabs/aws-sdk-go/aws"
Expand Down Expand Up @@ -66,3 +67,33 @@ func protocolIntegers() map[string]int {
}
return protocolIntegers
}

// expectedPortPair stores a pair of ports we expect to see together.
type expectedPortPair struct {
to_port int64
from_port int64
}

// validatePorts ensures the ports and protocol match expected
// values.
func validatePorts(to int64, from int64, expected expectedPortPair) bool {
if to != expected.to_port || from != expected.from_port {
return false
}

return true
}

// validateCIDRBlock ensures the passed CIDR block represents an implied
// network, and not an overly-specified IP address.
func validateCIDRBlock(cidr string) error {
_, ipnet, err := net.ParseCIDR(cidr)
if err != nil {
return err
}
if ipnet.String() != cidr {
return fmt.Errorf("%s is not a valid mask; did you mean %s?", cidr, ipnet)
}

return nil
}
37 changes: 37 additions & 0 deletions builtin/providers/aws/network_acl_entry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,3 +135,40 @@ func Test_flattenNetworkACLEntry(t *testing.T) {
}

}

func Test_validatePorts(t *testing.T) {
for _, ts := range []struct {
to int64
from int64
expected *expectedPortPair
wanted bool
}{
{0, 0, &expectedPortPair{0, 0}, true},
{0, 1, &expectedPortPair{0, 0}, false},
} {
got := validatePorts(ts.to, ts.from, *ts.expected)
if got != ts.wanted {
t.Fatalf("Got: %t; Expected: %t\n", got, ts.wanted)
}
}
}

func Test_validateCIDRBlock(t *testing.T) {
for _, ts := range []struct {
cidr string
shouldErr bool
}{
{"10.2.2.0/24", false},
{"10.2.2.0/1234", true},
{"10/24", true},
{"10.2.2.2/24", true},
} {
err := validateCIDRBlock(ts.cidr)
if ts.shouldErr && err == nil {
t.Fatalf("Input '%s' should error but didn't!", ts.cidr)
}
if !ts.shouldErr && err != nil {
t.Fatalf("Got unexpected error for '%s' input: %s", ts.cidr, err)
}
}
}
4 changes: 0 additions & 4 deletions builtin/providers/aws/resource_aws_autoscaling_group_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,6 @@ func testAccCheckAWSAutoScalingGroupHealthyCapacity(

const testAccAWSAutoScalingGroupConfig = `
resource "aws_launch_configuration" "foobar" {
name = "foobarautoscaling-terraform-test"
image_id = "ami-21f78e11"
instance_type = "t1.micro"
}
Expand Down Expand Up @@ -313,13 +312,11 @@ resource "aws_autoscaling_group" "bar" {

const testAccAWSAutoScalingGroupConfigUpdate = `
resource "aws_launch_configuration" "foobar" {
name = "foobarautoscaling-terraform-test"
image_id = "ami-21f78e11"
instance_type = "t1.micro"
}
resource "aws_launch_configuration" "new" {
name = "foobarautoscaling-terraform-test-new"
image_id = "ami-21f78e11"
instance_type = "t1.micro"
}
Expand Down Expand Up @@ -358,7 +355,6 @@ resource "aws_elb" "bar" {
}
resource "aws_launch_configuration" "foobar" {
name = "foobarautoscaling-terraform-test"
image_id = "ami-21f78e11"
instance_type = "t1.micro"
}
Expand Down
6 changes: 3 additions & 3 deletions builtin/providers/aws/resource_aws_customer_gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func resourceAwsCustomerGatewayCreate(d *schema.ResourceData, meta interface{})
}

// Create tags.
if err := setTagsSDK(conn, d); err != nil {
if err := setTags(conn, d); err != nil {
return err
}

Expand Down Expand Up @@ -147,7 +147,7 @@ func resourceAwsCustomerGatewayRead(d *schema.ResourceData, meta interface{}) er
d.Set("bgp_asn", customerGateway.BGPASN)
d.Set("ip_address", customerGateway.IPAddress)
d.Set("type", customerGateway.Type)
d.Set("tags", tagsToMapSDK(customerGateway.Tags))
d.Set("tags", tagsToMap(customerGateway.Tags))

return nil
}
Expand All @@ -156,7 +156,7 @@ func resourceAwsCustomerGatewayUpdate(d *schema.ResourceData, meta interface{})
conn := meta.(*AWSClient).ec2conn

// Update tags if required.
if err := setTagsSDK(conn, d); err != nil {
if err := setTags(conn, d); err != nil {
return err
}

Expand Down
Loading

0 comments on commit 233a5f4

Please sign in to comment.