Skip to content

Commit

Permalink
Fix up bad merge commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Xavier Salazar committed Mar 17, 2020
1 parent 3bad656 commit ccdf604
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 5 deletions.
3 changes: 1 addition & 2 deletions aws/opsworks_layers.go
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ func (lt *opsworksLayerType) Read(d *schema.ResourceData, client *opsworks.OpsWo
},
}
autoScalings, err := client.DescribeLoadBasedAutoScaling(ascRequest)

if err != nil {
return err
}
Expand Down Expand Up @@ -527,7 +527,6 @@ func (lt *opsworksLayerType) Create(d *schema.ResourceData, client *opsworks.Ops
}
}


return lt.Read(d, client)
}

Expand Down
82 changes: 79 additions & 3 deletions aws/resource_aws_opsworks_custom_layer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/terraform"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/service/opsworks"
)

Expand Down Expand Up @@ -176,7 +175,7 @@ func TestAccAWSOpsworksCustomLayer_autoscaling(t *testing.T) {
{
Config: testAccAwsOpsworksCustomLayerAutoscalingGroup(stackName, false),
Check: resource.ComposeTestCheckFunc(
testAccCheckAWSOpsworksCustomLayerExists(resourceName, &opslayer),
testAccCheckAWSOpsworksLayerExists(resourceName, &opslayer),
testAccCheckAWSOpsworksCreateLayerAttributes(&opslayer, stackName),
resource.TestCheckResourceAttr(resourceName, "name", stackName),
resource.TestCheckResourceAttr(resourceName, "enable_load_based_autoscaling", "false"),
Expand All @@ -186,7 +185,7 @@ func TestAccAWSOpsworksCustomLayer_autoscaling(t *testing.T) {
{
Config: testAccAwsOpsworksCustomLayerAutoscalingGroup(stackName, true),
Check: resource.ComposeTestCheckFunc(
testAccCheckAWSOpsworksCustomLayerExists(resourceName, &opslayer),
testAccCheckAWSOpsworksLayerExists(resourceName, &opslayer),
testAccCheckAWSOpsworksCreateLayerAttributes(&opslayer, stackName),
resource.TestCheckResourceAttr(resourceName, "name", stackName),
resource.TestCheckResourceAttr(resourceName, "enable_load_based_autoscaling", "true"),
Expand Down Expand Up @@ -534,3 +533,80 @@ resource "aws_opsworks_custom_layer" "tf-acc" {
%s
`, name, enable, testAccAwsOpsworksStackConfigNoVpcCreate(name), testAccAwsOpsworksCustomLayerSecurityGroups(name))
}

func testAccAwsOpsworksCustomLayerConfigTags1(name, tagKey1, tagValue1 string) string {
return testAccAwsOpsworksStackConfigVpcCreate(name) +
testAccAwsOpsworksCustomLayerSecurityGroups(name) +
fmt.Sprintf(`
resource "aws_opsworks_custom_layer" "test" {
stack_id = "${aws_opsworks_stack.tf-acc.id}"
name = %[1]q
short_name = "tf-ops-acc-custom-layer"
auto_assign_public_ips = false
custom_security_group_ids = [
"${aws_security_group.tf-ops-acc-layer1.id}",
"${aws_security_group.tf-ops-acc-layer2.id}",
]
drain_elb_on_shutdown = true
instance_shutdown_timeout = 300
system_packages = [
"git",
"golang",
]
ebs_volume {
type = "gp2"
number_of_disks = 2
mount_point = "/home"
size = 100
raid_level = 0
}
tags = {
%[2]q = %[3]q
}
}
`, name, tagKey1, tagValue1)
}

func testAccAwsOpsworksCustomLayerConfigTags2(name, tagKey1, tagValue1, tagKey2, tagValue2 string) string {
return testAccAwsOpsworksStackConfigVpcCreate(name) +
testAccAwsOpsworksCustomLayerSecurityGroups(name) +
fmt.Sprintf(`
resource "aws_opsworks_custom_layer" "test" {
stack_id = "${aws_opsworks_stack.tf-acc.id}"
name = %[1]q
short_name = "tf-ops-acc-custom-layer"
auto_assign_public_ips = false
custom_security_group_ids = [
"${aws_security_group.tf-ops-acc-layer1.id}",
"${aws_security_group.tf-ops-acc-layer2.id}",
]
drain_elb_on_shutdown = true
instance_shutdown_timeout = 300
system_packages = [
"git",
"golang",
]
ebs_volume {
type = "gp2"
number_of_disks = 2
mount_point = "/home"
size = 100
raid_level = 0
}
tags = {
%[2]q = %[3]q
%[4]q = %[5]q
}
}
`, name, tagKey1, tagValue1, tagKey2, tagValue2)
}

0 comments on commit ccdf604

Please sign in to comment.