Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
echuvyrov committed Apr 12, 2017
2 parents 85ed0f6 + 7fbc7d0 commit be80f8a
Show file tree
Hide file tree
Showing 195 changed files with 4,430 additions and 696 deletions.
11 changes: 10 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ FEATURES:
* **New Resource:** `aws_lightsail_static_ip` [GH-13175]
* **New Resource:** `aws_lightsail_static_ip_attachment` [GH-13207]
* **New Resource:** `aws_ses_domain_identity` [GH-13098]
* **New Resource**: `azurerm_managed_disk` [GH-12455]
* **New Resource:** `azurerm_managed_disk` [GH-12455]
* **New Resource:** `kubernetes_persistent_volume` [GH-13277]
* **New Resource:** `kubernetes_secret` [GH-12960]
* **New Data Source:** `aws_iam_role` [GH-13213]

Expand Down Expand Up @@ -38,12 +39,17 @@ IMPROVEMENTS:
* provider/aws: Add support for treat_missing_data to cloudwatch_metric_alarm [GH-13358]
* provider/aws: Add support for evaluate_low_sample_count_percentiles to cloudwatch_metric_alarm [GH-13371]
* provider/aws: Add `name_prefix` to `aws_alb_target_group` [GH-13442]
* provider/aws: Add support for EMR clusters to aws_appautoscaling_target [GH-13368]
* provider/bitbucket: Improved error handling [GH-13390]
* provider/cloudstack: Do not force a new resource when updating `cloudstack_loadbalancer_rule` members [GH-11786]
* provider/fastly: Add support for Sumologic logging [GH-12541]
* provider/github: Handle the case when issue labels already exist [GH-13182]
* provider/google: Mark `google_container_cluster`'s `client_key` & `password` inside `master_auth` as sensitive [GH-13148]
* provider/kubernetes: Allow defining custom config context [GH-12958]
* provider/openstack: Add support for 'value_specs' options to `openstack_compute_servergroup_v2` [GH-13380]
* provider/statuscake: Add support for StatusCake TriggerRate field [GH-13340]
* provider/triton: Move to joyent/triton-go [GH-13225]
* provisioner/chef: Make sure we add new Chef-Vault clients as clients [GH-13525]

BUG FIXES:

Expand Down Expand Up @@ -77,9 +83,12 @@ BUG FIXES:
* provider/aws: Fix `aws_s3_bucket` drift detection of logging options [GH-13281]
* provider/aws: Update ElasticTranscoderPreset to have default for MaxFrameRate [GH-13422]
* provider/aws: Fix aws_ami_launch_permission refresh when AMI disappears [GH-13469]
* provider/aws: Add support for updating SSM documents [GH-13491]
* provider/azurerm: Network Security Group - ignoring protocol casing at Import time [GH-13153]
* provider/azurerm: Fix crash when importing Local Network Gateways [GH-13261]
* provider/azurerm: Defaulting the value of `duplicate_detection_history_time_window` for `azurerm_servicebus_topic` [GH-13223]
* provider/bitbucket: Fixed issue where provider would fail with an "EOF" error on some operations [GH-13390]
* provider/kubernetes: Use PATCH to update namespace [GH-13114]
* provider/ns1: No splitting answer on SPF records. [GH-13260]
* provider/openstack: Refresh volume_attachment from state if NotFound [GH-13342]
* provider/openstack: Add SOFT_DELETED to delete status [GH-13444]
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Terraform
- [![Gitter chat](https://badges.gitter.im/hashicorp-terraform/Lobby.png)](https://gitter.im/hashicorp-terraform/Lobby)
- Mailing list: [Google Groups](http://groups.google.com/group/terraform-tool)

![Terraform](https://raw.githubusercontent.com/hashicorp/terraform/master/website/source/assets/images/readme.png)
![Terraform](https://rawgithub.com/hashicorp/terraform/master/website/source/assets/images/logo-hashicorp.svg)

Terraform is a tool for building, changing, and versioning infrastructure safely and efficiently. Terraform can manage existing and popular service providers as well as custom in-house solutions.

Expand Down
79 changes: 44 additions & 35 deletions builtin/providers/aws/data_source_aws_subnet_ids_test.go
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
package aws

import (
"fmt"
"testing"

"github.com/hashicorp/terraform/helper/acctest"
"github.com/hashicorp/terraform/helper/resource"
)

func TestAccDataSourceAwsSubnetIDs(t *testing.T) {
rInt := acctest.RandIntRange(0, 256)
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
Steps: []resource.TestStep{
{
Config: testAccDataSourceAwsSubnetIDsConfig,
Config: testAccDataSourceAwsSubnetIDsConfig(rInt),
},
{
Config: testAccDataSourceAwsSubnetIDsConfigWithDataSource,
Config: testAccDataSourceAwsSubnetIDsConfigWithDataSource(rInt),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("data.aws_subnet_ids.selected", "ids.#", "1"),
),
Expand All @@ -24,45 +27,51 @@ func TestAccDataSourceAwsSubnetIDs(t *testing.T) {
})
}

const testAccDataSourceAwsSubnetIDsConfigWithDataSource = `
resource "aws_vpc" "test" {
cidr_block = "172.16.0.0/16"
func testAccDataSourceAwsSubnetIDsConfigWithDataSource(rInt int) string {
return fmt.Sprintf(
`
resource "aws_vpc" "test" {
cidr_block = "172.%d.0.0/16"
tags {
Name = "terraform-testacc-subnet-ids-data-source"
}
}
tags {
Name = "terraform-testacc-subnet-ids-data-source"
}
}
resource "aws_subnet" "test" {
vpc_id = "${aws_vpc.test.id}"
cidr_block = "172.16.123.0/24"
availability_zone = "us-west-2a"
resource "aws_subnet" "test" {
vpc_id = "${aws_vpc.test.id}"
cidr_block = "172.%d.123.0/24"
availability_zone = "us-west-2a"
tags {
Name = "terraform-testacc-subnet-ids-data-source"
}
}
tags {
Name = "terraform-testacc-subnet-ids-data-source"
}
}
data "aws_subnet_ids" "selected" {
vpc_id = "${aws_vpc.test.id}"
data "aws_subnet_ids" "selected" {
vpc_id = "${aws_vpc.test.id}"
}
`, rInt, rInt)
}
`
const testAccDataSourceAwsSubnetIDsConfig = `
resource "aws_vpc" "test" {
cidr_block = "172.16.0.0/16"

tags {
Name = "terraform-testacc-subnet-ids-data-source"
}
}
func testAccDataSourceAwsSubnetIDsConfig(rInt int) string {
return fmt.Sprintf(`
resource "aws_vpc" "test" {
cidr_block = "172.%d.0.0/16"
tags {
Name = "terraform-testacc-subnet-ids-data-source"
}
}
resource "aws_subnet" "test" {
vpc_id = "${aws_vpc.test.id}"
cidr_block = "172.16.123.0/24"
availability_zone = "us-west-2a"
resource "aws_subnet" "test" {
vpc_id = "${aws_vpc.test.id}"
cidr_block = "172.%d.123.0/24"
availability_zone = "us-west-2a"
tags {
Name = "terraform-testacc-subnet-ids-data-source"
}
tags {
Name = "terraform-testacc-subnet-ids-data-source"
}
}
`, rInt, rInt)
}
`
99 changes: 52 additions & 47 deletions builtin/providers/aws/data_source_aws_subnet_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,33 @@ import (
"fmt"
"testing"

"github.com/hashicorp/terraform/helper/acctest"
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/terraform"
)

func TestAccDataSourceAwsSubnet(t *testing.T) {
rInt := acctest.RandIntRange(0, 256)

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
Steps: []resource.TestStep{
resource.TestStep{
Config: testAccDataSourceAwsSubnetConfig,
Config: testAccDataSourceAwsSubnetConfig(rInt),
Check: resource.ComposeTestCheckFunc(
testAccDataSourceAwsSubnetCheck("data.aws_subnet.by_id"),
testAccDataSourceAwsSubnetCheck("data.aws_subnet.by_cidr"),
testAccDataSourceAwsSubnetCheck("data.aws_subnet.by_tag"),
testAccDataSourceAwsSubnetCheck("data.aws_subnet.by_vpc"),
testAccDataSourceAwsSubnetCheck("data.aws_subnet.by_filter"),
testAccDataSourceAwsSubnetCheck("data.aws_subnet.by_id", rInt),
testAccDataSourceAwsSubnetCheck("data.aws_subnet.by_cidr", rInt),
testAccDataSourceAwsSubnetCheck("data.aws_subnet.by_tag", rInt),
testAccDataSourceAwsSubnetCheck("data.aws_subnet.by_vpc", rInt),
testAccDataSourceAwsSubnetCheck("data.aws_subnet.by_filter", rInt),
),
},
},
})
}

func testAccDataSourceAwsSubnetCheck(name string) resource.TestCheckFunc {
func testAccDataSourceAwsSubnetCheck(name string, rInt int) resource.TestCheckFunc {
return func(s *terraform.State) error {
rs, ok := s.RootModule().Resources[name]
if !ok {
Expand Down Expand Up @@ -61,65 +64,67 @@ func testAccDataSourceAwsSubnetCheck(name string) resource.TestCheckFunc {
)
}

if attr["cidr_block"] != "172.16.123.0/24" {
if attr["cidr_block"] != fmt.Sprintf("172.%d.123.0/24", rInt) {
return fmt.Errorf("bad cidr_block %s", attr["cidr_block"])
}
if attr["availability_zone"] != "us-west-2a" {
return fmt.Errorf("bad availability_zone %s", attr["availability_zone"])
}
if attr["tags.Name"] != "terraform-testacc-subnet-data-source" {
if attr["tags.Name"] != fmt.Sprintf("terraform-testacc-subnet-data-source-%d", rInt) {
return fmt.Errorf("bad Name tag %s", attr["tags.Name"])
}

return nil
}
}

const testAccDataSourceAwsSubnetConfig = `
provider "aws" {
region = "us-west-2"
}
func testAccDataSourceAwsSubnetConfig(rInt int) string {
return fmt.Sprintf(`
provider "aws" {
region = "us-west-2"
}
resource "aws_vpc" "test" {
cidr_block = "172.16.0.0/16"
resource "aws_vpc" "test" {
cidr_block = "172.%d.0.0/16"
tags {
Name = "terraform-testacc-subnet-data-source"
}
}
tags {
Name = "terraform-testacc-subnet-data-source"
}
}
resource "aws_subnet" "test" {
vpc_id = "${aws_vpc.test.id}"
cidr_block = "172.16.123.0/24"
availability_zone = "us-west-2a"
resource "aws_subnet" "test" {
vpc_id = "${aws_vpc.test.id}"
cidr_block = "172.%d.123.0/24"
availability_zone = "us-west-2a"
tags {
Name = "terraform-testacc-subnet-data-source"
}
}
tags {
Name = "terraform-testacc-subnet-data-source-%d"
}
}
data "aws_subnet" "by_id" {
id = "${aws_subnet.test.id}"
}
data "aws_subnet" "by_id" {
id = "${aws_subnet.test.id}"
}
data "aws_subnet" "by_cidr" {
cidr_block = "${aws_subnet.test.cidr_block}"
}
data "aws_subnet" "by_cidr" {
cidr_block = "${aws_subnet.test.cidr_block}"
}
data "aws_subnet" "by_tag" {
tags {
Name = "${aws_subnet.test.tags["Name"]}"
}
}
data "aws_subnet" "by_tag" {
tags {
Name = "${aws_subnet.test.tags["Name"]}"
}
}
data "aws_subnet" "by_vpc" {
vpc_id = "${aws_subnet.test.vpc_id}"
}
data "aws_subnet" "by_vpc" {
vpc_id = "${aws_subnet.test.vpc_id}"
}
data "aws_subnet" "by_filter" {
filter {
name = "vpc-id"
values = ["${aws_subnet.test.vpc_id}"]
}
data "aws_subnet" "by_filter" {
filter {
name = "vpc-id"
values = ["${aws_subnet.test.vpc_id}"]
}
}
`, rInt, rInt, rInt)
}
`
18 changes: 6 additions & 12 deletions builtin/providers/aws/resource_aws_appautoscaling_target.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,33 +20,33 @@ func resourceAwsAppautoscalingTarget() *schema.Resource {
Delete: resourceAwsAppautoscalingTargetDelete,

Schema: map[string]*schema.Schema{
"max_capacity": &schema.Schema{
"max_capacity": {
Type: schema.TypeInt,
Required: true,
ForceNew: true,
},
"min_capacity": &schema.Schema{
"min_capacity": {
Type: schema.TypeInt,
Required: true,
ForceNew: true,
},
"resource_id": &schema.Schema{
"resource_id": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
},
"role_arn": &schema.Schema{
"role_arn": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
},
"scalable_dimension": &schema.Schema{
"scalable_dimension": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: validateAppautoscalingScalableDimension,
},
"service_namespace": &schema.Schema{
"service_namespace": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
Expand Down Expand Up @@ -116,12 +116,6 @@ func resourceAwsAppautoscalingTargetRead(d *schema.ResourceData, meta interface{
return nil
}

// Updating Target is not supported
// func getAwsAppautoscalingTargetUpdate(d *schema.ResourceData, meta interface{}) error {
// conn := meta.(*AWSClient).appautoscalingconn

// }

func resourceAwsAppautoscalingTargetDelete(d *schema.ResourceData, meta interface{}) error {
conn := meta.(*AWSClient).appautoscalingconn

Expand Down
Loading

0 comments on commit be80f8a

Please sign in to comment.