Skip to content

Commit

Permalink
Add import for dynamodb_table_item_attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
Julien Duchesne committed Sep 29, 2018
1 parent 7087d63 commit 3cb6a0b
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
3 changes: 3 additions & 0 deletions aws/resource_aws_dynamodb_table_item_attribute.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ func resourceAwsDynamoDbTableItemAttribute() *schema.Resource {
Read: resourceAwsDynamoDbTableItemAttributeRead,
Update: resourceAwsDynamoDbTableItemAttributeUpdate,
Delete: resourceAwsDynamoDbTableItemAttributeDelete,
Importer: &schema.ResourceImporter{
State: schema.ImportStatePassthrough,
},

Schema: map[string]*schema.Schema{
"table_name": {
Expand Down
10 changes: 10 additions & 0 deletions aws/resource_aws_dynamodb_table_item_attribute_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ func TestAccAWSDynamoDbTableItemAttribute_basic(t *testing.T) {
resource.TestCheckResourceAttr(resourceName, "attribute_value", attributeValue),
),
},
{
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
},
},
})
}
Expand Down Expand Up @@ -99,6 +104,11 @@ func TestAccAWSDynamoDbTableItemAttribute_withRangeKey(t *testing.T) {
resource.TestCheckResourceAttr(resourceName, "attribute_value", attributeValue),
),
},
{
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
},
},
})
}
Expand Down
12 changes: 11 additions & 1 deletion website/docs/r/dynamodb_table_item_attribute.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,14 @@ All of the arguments above are exported as attributes.

## Import

DynamoDB table items cannot be imported.
DynamoDB table item attributes can be imported using the table name, hash key value, range key value and attribute key, e.g.

Without a range key:
```
$ terraform import aws_dynamodb_table_item_attribute.example table_name:hash_key_value::attribute_key
```

With a range key:
```
$ terraform import aws_dynamodb_table_item_attribute.example table_name:hash_key_value:range_key_value:attribute_key
```

0 comments on commit 3cb6a0b

Please sign in to comment.