Skip to content

Commit

Permalink
Merge pull request hashicorp#20 from pmoust/master
Browse files Browse the repository at this point in the history
sync upstream
  • Loading branch information
pmoust committed Apr 1, 2015
2 parents b3d5070 + fa85adf commit a6c7c55
Show file tree
Hide file tree
Showing 130 changed files with 9,558 additions and 189 deletions.
46 changes: 41 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,26 @@ BACKWARDS INCOMPATIBILITIES:
FEATURES:

* **New provider: `dme` (DNSMadeEasy)** [GH-855]
* **New provider: `docker` (Docker)** - Manage container lifecycle
using the standard Docker API. [GH-855]
* **New provider: `openstack` (OpenStack)** - Interact with the many resources
provided by OpenStack. [GH-924]
* **New command: `taint`** - Manually mark a resource as tainted, causing
a destroy and recreate on the next plan/apply.
* **New resource: `aws_vpn_gateway`** [GH-1137]
* **New resource: `aws_elastic_network_interfaces`** [GH-1149]
* **Self-variables** can be used to reference the current resource's
attributes within a provisioner. Ex. `${self.private_ip_address}` [GH-1033]
* **Continous state** saving during `terraform apply`. The state file is
continously updated as apply is running, meaning that the state is
* **Continuous state** saving during `terraform apply`. The state file is
continuously updated as apply is running, meaning that the state is
less likely to become corrupt in a catastrophic case: terraform panic
or system killing Terraform.
* **Math operations** in interpolations. You can now do things like
`${count.index+1}`. [GH-1068]
* **New AWS SDK:** Move to `aws-sdk-go` (hashicorp/aws-sdk-go),
a fork of the offical `awslabs` repo. We forked for stability while
`awslabs` refactored the library, and will move back to the officially
supported version in the next release.

IMPROVEMENTS:

Expand All @@ -34,12 +43,20 @@ IMPROVEMENTS:
* **New config function: `split`** - Split a value based on a delimiter.
This is useful for faking lists as parameters to modules.
* **New resource: `digitalocean_ssh_key`** [GH-1074]
* **New resource: `aws_elastic_network_interfaces`** [GH-1149]
* config: Expand `~` with homedir in `file()` paths [GH-1338]
* core: The serial of the state is only updated if there is an actual
change. This will lower the amount of state changing on things
like refresh.
* core: Autoload `terraform.tfvars.json` as well as `terraform.tfvars` [GH-1030]
* core: `.tf` files that start with a period are now ignored. [GH-1227]
* command/remote-config: After enabling remote state, a `pull` is
automatically done initially.
* providers/google: Add `size` option to disk blocks for instances. [GH-1284]
* providers/aws: Improve support for tagging resources.
* providers/aws: Add a short syntax for Route 53 Record names, e.g.
`www` instead of `www.example.com`.
* providers/aws: Improve dependency violation error handling, when deleting
Internet Gateways or Auto Scaling groups [GH-1325].

BUG FIXES:

Expand All @@ -52,13 +69,31 @@ BUG FIXES:
a computed attribute was used as part of a set parameter. [GH-1073]
* core: Fix edge case where state containing both "resource" and
"resource.0" would ignore the latter completely. [GH-1086]
* core: Modules with a source of a relative file path moving up
directories work properly, i.e. "../a" [GH-1232]
* providers/aws: manually deleted VPC removes it from the state
* providers/aws: `source_dest_check` regression fixed (now works). [GH-1020]
* providers/aws: Longer wait times for DB instances.
* providers/aws: Longer wait times for route53 records (30 mins). [GH-1164]
* providers/aws: Fix support for TXT records in Route 53. [GH-1213]
* providers/aws: Fix support for wildcard records in Route 53. [GH-1222]
* providers/aws: Fix issue with ignoring the 'self' attribute of a
Security Group rule. [GH-1223]
* providers/aws: Fix issue with `sql_mode` in RDS parameter group always
causing an update. [GH-1225]
* providers/aws: Fix dependency violation with subnets and security groups
[GH-1252]
* providers/aws: Fix issue with refreshing `db_subnet_groups` causing an error
instead of updating state [GH-1254]
* providers/aws: Prevent empty string to be used as default
`health_check_type` [GH-1052]
* providers/aws: Add tags on AWS IG creation, not just on update [GH-1176]
* providers/digitalocean: Waits until droplet is ready to be destroyed [GH-1057]
* providers/digitalocean: More lenient about 404's while waiting [GH-1062]
* providers/digitalocean: FQDN for domain records in CNAME, MX, NS, etc.
Also fixes invalid updates in plans. [GH-863]
* providers/google: Network data in state was not being stored. [GH-1095]
* providers/heroku: Fix panic when config vars block was empty. [GH-1211]

PLUGIN CHANGES:

Expand All @@ -85,7 +120,7 @@ IMPROVEMENTS:
* provider/aws: The `aws_db_instance` resource no longer requires both
`final_snapshot_identifier` and `skip_final_snapshot`; the presence or
absence of the former now implies the latter. [GH-874]
* provider/aws: Avoid unecessary update of `aws_subnet` when
* provider/aws: Avoid unnecessary update of `aws_subnet` when
`map_public_ip_on_launch` is not specified in config. [GH-898]
* provider/aws: Add `apply_method` to `aws_db_parameter_group` [GH-897]
* provider/aws: Add `storage_type` to `aws_db_instance` [GH-896]
Expand Down Expand Up @@ -118,7 +153,7 @@ BUG FIXES:
* command/apply: Fix regression where user variables weren't asked [GH-736]
* helper/hashcode: Update `hash.String()` to always return a positive index.
Fixes issue where specific strings would convert to a negative index
and be ommited when creating Route53 records. [GH-967]
and be omitted when creating Route53 records. [GH-967]
* provider/aws: Automatically suffix the Route53 zone name on record names. [GH-312]
* provider/aws: Instance should ignore root EBS devices. [GH-877]
* provider/aws: Fix `aws_db_instance` to not recreate each time. [GH-874]
Expand Down Expand Up @@ -524,3 +559,4 @@ BUG FIXES:

* Initial release


4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ If you have never worked with Go before, you will have to complete the
following steps in order to be able to compile and test Terraform (or
use the Vagrantfile in this repo to stand up a dev VM).

1. Install Go. Make sure the Go version is at least Go 1.2. Terraform will not work with anything less than
Go 1.2. On a Mac, you can `brew install go` to install Go 1.2.
1. Install Go. Make sure the Go version is at least Go 1.4. Terraform will not work with anything less than
Go 1.4. On a Mac, you can `brew install go` to install Go 1.4.

2. Set and export the `GOPATH` environment variable and update your `PATH`.
For example, you can add to your `.bash_profile`.
Expand Down
12 changes: 12 additions & 0 deletions builtin/bins/provider-docker/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package main

import (
"github.com/hashicorp/terraform/builtin/providers/docker"
"github.com/hashicorp/terraform/plugin"
)

func main() {
plugin.Serve(&plugin.ServeOpts{
ProviderFunc: docker.Provider,
})
}
1 change: 1 addition & 0 deletions builtin/bins/provider-docker/main_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package main
12 changes: 12 additions & 0 deletions builtin/bins/provider-openstack/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package main

import (
"github.com/hashicorp/terraform/builtin/providers/openstack"
"github.com/hashicorp/terraform/plugin"
)

func main() {
plugin.Serve(&plugin.ServeOpts{
ProviderFunc: openstack.Provider,
})
}
23 changes: 14 additions & 9 deletions builtin/providers/aws/resource_aws_autoscaling_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,15 +193,15 @@ func resourceAwsAutoscalingGroupRead(d *schema.ResourceData, meta interface{}) e
}

d.Set("availability_zones", g.AvailabilityZones)
d.Set("default_cooldown", *g.DefaultCooldown)
d.Set("desired_capacity", *g.DesiredCapacity)
d.Set("health_check_grace_period", *g.HealthCheckGracePeriod)
d.Set("health_check_type", *g.HealthCheckType)
d.Set("launch_configuration", *g.LaunchConfigurationName)
d.Set("default_cooldown", g.DefaultCooldown)
d.Set("desired_capacity", g.DesiredCapacity)
d.Set("health_check_grace_period", g.HealthCheckGracePeriod)
d.Set("health_check_type", g.HealthCheckType)
d.Set("launch_configuration", g.LaunchConfigurationName)
d.Set("load_balancers", g.LoadBalancerNames)
d.Set("min_size", *g.MinSize)
d.Set("max_size", *g.MaxSize)
d.Set("name", *g.AutoScalingGroupName)
d.Set("min_size", g.MinSize)
d.Set("max_size", g.MaxSize)
d.Set("name", g.AutoScalingGroupName)
d.Set("tag", g.Tags)
d.Set("vpc_zone_identifier", strings.Split(*g.VPCZoneIdentifier, ","))
d.Set("termination_policies", g.TerminationPolicies)
Expand Down Expand Up @@ -287,7 +287,12 @@ func resourceAwsAutoscalingGroupDelete(d *schema.ResourceData, meta interface{})
return err
}

return nil
return resource.Retry(5*time.Minute, func() error {
if g, _ = getAwsAutoscalingGroup(d, meta); g != nil {
return fmt.Errorf("Auto Scaling Group still exists")
}
return nil
})
}

func getAwsAutoscalingGroup(
Expand Down
30 changes: 17 additions & 13 deletions builtin/providers/aws/resource_aws_autoscaling_group_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func TestAccAWSAutoScalingGroup_basic(t *testing.T) {
testAccCheckAWSAutoScalingGroupExists("aws_autoscaling_group.bar", &group),
testAccCheckAWSAutoScalingGroupAttributes(&group),
resource.TestCheckResourceAttr(
"aws_autoscaling_group.bar", "availability_zones.2487133097", "us-west-2a"),
"aws_autoscaling_group.bar", "availability_zones.1807834199", "us-west-2a"),
resource.TestCheckResourceAttr(
"aws_autoscaling_group.bar", "name", "foobar3-terraform-test"),
resource.TestCheckResourceAttr(
Expand Down Expand Up @@ -54,8 +54,10 @@ func TestAccAWSAutoScalingGroup_basic(t *testing.T) {
resource.TestCheckResourceAttr(
"aws_autoscaling_group.bar", "desired_capacity", "5"),
testLaunchConfigurationName("aws_autoscaling_group.bar", &lc),
resource.TestCheckResourceAttr(
"aws_autoscaling_group.bar", "tag", "xxx"),
testAccCheckAutoscalingTags(&group.Tags, "Bar", map[string]interface{}{
"value": "bar-foo",
"propagate_at_launch": true,
}),
),
},
},
Expand All @@ -74,20 +76,20 @@ func TestAccAWSAutoScalingGroup_tags(t *testing.T) {
Config: testAccAWSAutoScalingGroupConfig,
Check: resource.ComposeTestCheckFunc(
testAccCheckAWSAutoScalingGroupExists("aws_autoscaling_group.bar", &group),
testAccCheckAutoscalingTags(&group.Tags, "foo", map[string]interface{}{
"value": "bar",
testAccCheckAutoscalingTags(&group.Tags, "Foo", map[string]interface{}{
"value": "foo-bar",
"propagate_at_launch": true,
}),
),
},

resource.TestStep{
Config: testAccCheckInstanceConfigTagsUpdate,
Config: testAccAWSAutoScalingGroupConfigUpdate,
Check: resource.ComposeTestCheckFunc(
testAccCheckAWSAutoScalingGroupExists("aws_autoscaling_group.bar", &group),
testAccCheckAutoscalingTagNotExists(&group.Tags, "foo"),
testAccCheckAutoscalingTags(&group.Tags, "bar", map[string]interface{}{
"value": "baz",
testAccCheckAutoscalingTagNotExists(&group.Tags, "Foo"),
testAccCheckAutoscalingTags(&group.Tags, "Bar", map[string]interface{}{
"value": "bar-foo",
"propagate_at_launch": true,
}),
),
Expand Down Expand Up @@ -182,10 +184,12 @@ func testAccCheckAWSAutoScalingGroupAttributes(group *autoscaling.AutoScalingGro
return fmt.Errorf("Bad launch configuration name: %s", *group.LaunchConfigurationName)
}

t := autoscaling.Tag{
Key: aws.String("Name"),
t := autoscaling.TagDescription{
Key: aws.String("Foo"),
Value: aws.String("foo-bar"),
PropagateAtLaunch: aws.Boolean(true),
ResourceType: aws.String("auto-scaling-group"),
ResourceID: group.AutoScalingGroupName,
}

if !reflect.DeepEqual(group.Tags[0], t) {
Expand Down Expand Up @@ -278,7 +282,7 @@ resource "aws_autoscaling_group" "bar" {
launch_configuration = "${aws_launch_configuration.foobar.name}"
tag {
key = "Name"
key = "Foo"
value = "foo-bar"
propagate_at_launch = true
}
Expand Down Expand Up @@ -311,7 +315,7 @@ resource "aws_autoscaling_group" "bar" {
launch_configuration = "${aws_launch_configuration.new.name}"
tag {
key = "Name"
key = "Bar"
value = "bar-foo"
propagate_at_launch = true
}
Expand Down
6 changes: 5 additions & 1 deletion builtin/providers/aws/resource_aws_db_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,11 @@ func resourceAwsDbInstanceRead(d *schema.ResourceData, meta interface{}) error {
return nil
}

d.Set("name", *v.DBName)
if v.DBName != nil {
d.Set("name", *v.DBName)
} else {
d.Set("name", "")
}
d.Set("username", *v.MasterUsername)
d.Set("engine", *v.Engine)
d.Set("engine_version", *v.EngineVersion)
Expand Down
6 changes: 6 additions & 0 deletions builtin/providers/aws/resource_aws_instance_migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,13 @@ func resourceAwsInstanceMigrateState(
}

func migrateStateV0toV1(is *terraform.InstanceState) (*terraform.InstanceState, error) {
if is.Empty() {
log.Println("[DEBUG] Empty InstanceState; nothing to migrate.")
return is, nil
}

log.Printf("[DEBUG] Attributes before migration: %#v", is.Attributes)

// Delete old count
delete(is.Attributes, "block_device.#")

Expand Down
24 changes: 24 additions & 0 deletions builtin/providers/aws/resource_aws_instance_migrate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ func TestAWSInstanceMigrateState(t *testing.T) {

for tn, tc := range cases {
is := &terraform.InstanceState{
ID: "i-abc123",
Attributes: tc.Attributes,
}
is, err := resourceAwsInstanceMigrateState(
Expand All @@ -133,3 +134,26 @@ func TestAWSInstanceMigrateState(t *testing.T) {
}
}
}

func TestAWSInstanceMigrateState_empty(t *testing.T) {
var is *terraform.InstanceState
var meta interface{}

// should handle nil
is, err := resourceAwsInstanceMigrateState(0, is, meta)

if err != nil {
t.Fatalf("err: %#v", err)
}
if is != nil {
t.Fatalf("expected nil instancestate, got: %#v", is)
}

// should handle non-nil but empty
is = &terraform.InstanceState{}
is, err = resourceAwsInstanceMigrateState(0, is, meta)

if err != nil {
t.Fatalf("err: %#v", err)
}
}
Loading

0 comments on commit a6c7c55

Please sign in to comment.