Skip to content

Commit

Permalink
r/d-launch_configuration-arn addition
Browse files Browse the repository at this point in the history
  • Loading branch information
thatderek committed Jan 2, 2020
1 parent 2cd7bee commit a7c5975
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions aws/data_source_aws_launch_configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ func dataSourceAwsLaunchConfiguration() *schema.Resource {
return &schema.Resource{
Read: dataSourceAwsLaunchConfigurationRead,
Schema: map[string]*schema.Schema{
"arn": {
Type: schema.TypeString,
Computed: true,
},
"name": {
Type: schema.TypeString,
Required: true,
Expand Down Expand Up @@ -214,6 +218,7 @@ func dataSourceAwsLaunchConfigurationRead(d *schema.ResourceData, meta interface
d.Set("key_name", lc.KeyName)
d.Set("image_id", lc.ImageId)
d.Set("instance_type", lc.InstanceType)
d.Set("arn", lc.LaunchConfigurationARN)
d.Set("name", lc.LaunchConfigurationName)
d.Set("user_data", lc.UserData)
d.Set("iam_instance_profile", lc.IamInstanceProfile)
Expand Down
2 changes: 2 additions & 0 deletions aws/data_source_aws_launch_configuration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package aws

import (
"fmt"
"regexp"
"testing"

"github.com/hashicorp/terraform-plugin-sdk/helper/acctest"
Expand All @@ -26,6 +27,7 @@ func TestAccAWSLaunchConfigurationDataSource_basic(t *testing.T) {
resource.TestCheckResourceAttr(rName, "root_block_device.#", "1"),
resource.TestCheckResourceAttr(rName, "ebs_block_device.#", "1"),
resource.TestCheckResourceAttr(rName, "ephemeral_block_device.#", "1"),
testAccMatchResourceAttrRegionalARN(rName, "arn", "autoscaling", regexp.MustCompile(`launchConfiguration:.+`)),
),
},
},
Expand Down
5 changes: 5 additions & 0 deletions aws/resource_aws_launch_configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ func resourceAwsLaunchConfiguration() *schema.Resource {
},

Schema: map[string]*schema.Schema{
"arn": {
Type: schema.TypeString,
Computed: true,
},
"name": {
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -552,6 +556,7 @@ func resourceAwsLaunchConfigurationRead(d *schema.ResourceData, meta interface{}
d.Set("image_id", lc.ImageId)
d.Set("instance_type", lc.InstanceType)
d.Set("name", lc.LaunchConfigurationName)
d.Set("arn", lc.LaunchConfigurationARN)

d.Set("iam_instance_profile", lc.IamInstanceProfile)
d.Set("ebs_optimized", lc.EbsOptimized)
Expand Down
1 change: 1 addition & 0 deletions aws/resource_aws_launch_configuration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ func TestAccAWSLaunchConfiguration_basic(t *testing.T) {
Check: resource.ComposeTestCheckFunc(
testAccCheckAWSLaunchConfigurationExists(resourceName, &conf),
testAccCheckAWSLaunchConfigurationGeneratedNamePrefix(resourceName, "terraform-"),
testAccMatchResourceAttrRegionalARN(resourceName, "arn", "autoscaling", regexp.MustCompile(`launchConfiguration:.+`)),
),
},
{
Expand Down
1 change: 1 addition & 0 deletions website/docs/d/launch_configuration.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ The following arguments are supported:
In addition to all arguments above, the following attributes are exported:

* `id` - The ID of the launch configuration.
* `arn` - The Amazon Resource Name of the launch configuration.
* `name` - The Name of the launch configuration.
* `image_id` - The EC2 Image ID of the instance.
* `instance_type` - The Instance Type of the instance to launch.
Expand Down
1 change: 1 addition & 0 deletions website/docs/r/launch_configuration.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ configuration, resource recreation can be manually triggered by using the
In addition to all arguments above, the following attributes are exported:

* `id` - The ID of the launch configuration.
* `arn` - The Amazon Resource Name of the launch configuration.
* `name` - The name of the launch configuration.

[1]: /docs/providers/aws/r/autoscaling_group.html
Expand Down

0 comments on commit a7c5975

Please sign in to comment.