Merge branch 'DJRH-import-opsworks-stacks'
This commit is contained in:
commit
17cb9a19da
|
@ -0,0 +1,31 @@
|
|||
package aws
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/terraform/helper/acctest"
|
||||
"github.com/hashicorp/terraform/helper/resource"
|
||||
)
|
||||
|
||||
func TestAccAWSOpsworksStackImportBasic(t *testing.T) {
|
||||
name := acctest.RandString(10)
|
||||
|
||||
resourceName := "aws_opsworks_stack.tf-acc"
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckAwsOpsworksStackDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
resource.TestStep{
|
||||
Config: testAccAwsOpsworksStackConfigVpcCreate(name),
|
||||
},
|
||||
|
||||
resource.TestStep{
|
||||
ResourceName: resourceName,
|
||||
ImportState: true,
|
||||
ImportStateVerify: true,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
|
@ -20,6 +20,9 @@ func resourceAwsOpsworksStack() *schema.Resource {
|
|||
Read: resourceAwsOpsworksStackRead,
|
||||
Update: resourceAwsOpsworksStackUpdate,
|
||||
Delete: resourceAwsOpsworksStackDelete,
|
||||
Importer: &schema.ResourceImporter{
|
||||
State: schema.ImportStatePassthrough,
|
||||
},
|
||||
|
||||
Schema: map[string]*schema.Schema{
|
||||
"agent_version": &schema.Schema{
|
||||
|
@ -283,6 +286,9 @@ func resourceAwsOpsworksStackRead(d *schema.ResourceData, meta interface{}) erro
|
|||
d.Set("default_subnet_id", stack.DefaultSubnetId)
|
||||
d.Set("hostname_theme", stack.HostnameTheme)
|
||||
d.Set("use_custom_cookbooks", stack.UseCustomCookbooks)
|
||||
if stack.CustomJson != nil {
|
||||
d.Set("custom_json", stack.CustomJson)
|
||||
}
|
||||
d.Set("use_opsworks_security_groups", stack.UseOpsworksSecurityGroups)
|
||||
d.Set("vpc_id", stack.VpcId)
|
||||
if color, ok := stack.Attributes["Color"]; ok {
|
||||
|
|
|
@ -67,6 +67,7 @@ To make a resource importable, please see the
|
|||
* aws_nat_gateway
|
||||
* aws_network_acl
|
||||
* aws_network_interface
|
||||
* aws_opsworks_stack
|
||||
* aws_placement_group
|
||||
* aws_rds_cluster
|
||||
* aws_rds_cluster_instance
|
||||
|
|
|
@ -76,3 +76,12 @@ The `custom_cookbooks_source` block supports the following arguments:
|
|||
The following attributes are exported:
|
||||
|
||||
* `id` - The id of the stack.
|
||||
|
||||
|
||||
## Import
|
||||
|
||||
OpsWorks stacks can be imported using the `id`, e.g.
|
||||
|
||||
```
|
||||
$ terraform import aws_opsworks_stack.bar 00000000-0000-0000-0000-000000000000
|
||||
```
|
Loading…
Reference in New Issue