Add import functionality

This commit is contained in:
Matt Dainty 2017-02-14 18:09:48 +00:00
parent a08fbcbadb
commit 3939a7220d
No known key found for this signature in database
GPG Key ID: D57145DF9EBCC9BA
4 changed files with 30 additions and 0 deletions

View File

@ -17,6 +17,13 @@ func resourceAwsCloudWatchLogDestination() *schema.Resource {
Read: resourceAwsCloudWatchLogDestinationRead, Read: resourceAwsCloudWatchLogDestinationRead,
Delete: resourceAwsCloudWatchLogDestinationDelete, Delete: resourceAwsCloudWatchLogDestinationDelete,
Importer: &schema.ResourceImporter{
State: func(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) {
d.Set("name", d.Id())
return []*schema.ResourceData{d}, nil
},
},
Schema: map[string]*schema.Schema{ Schema: map[string]*schema.Schema{
"name": &schema.Schema{ "name": &schema.Schema{
Type: schema.TypeString, Type: schema.TypeString,

View File

@ -17,6 +17,13 @@ func resourceAwsCloudWatchLogDestinationPolicy() *schema.Resource {
Read: resourceAwsCloudWatchLogDestinationPolicyRead, Read: resourceAwsCloudWatchLogDestinationPolicyRead,
Delete: resourceAwsCloudWatchLogDestinationPolicyDelete, Delete: resourceAwsCloudWatchLogDestinationPolicyDelete,
Importer: &schema.ResourceImporter{
State: func(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) {
d.Set("destination_name", d.Id())
return []*schema.ResourceData{d}, nil
},
},
Schema: map[string]*schema.Schema{ Schema: map[string]*schema.Schema{
"destination_name": &schema.Schema{ "destination_name": &schema.Schema{
Type: schema.TypeString, Type: schema.TypeString,

View File

@ -33,3 +33,11 @@ The following arguments are supported:
The following attributes are exported: The following attributes are exported:
* `arn` - The Amazon Resource Name (ARN) specifying the log destination. * `arn` - The Amazon Resource Name (ARN) specifying the log destination.
## Import
CloudWatch Logs destinations can be imported using the `name`, e.g.
```
$ terraform import aws_cloudwatch_log_destination.test_destination test_destination
```

View File

@ -53,3 +53,11 @@ The following arguments are supported:
* `destination_name` - (Required) A name for the subscription filter * `destination_name` - (Required) A name for the subscription filter
* `access_policy` - (Required) The policy document. This is a JSON formatted string. * `access_policy` - (Required) The policy document. This is a JSON formatted string.
## Import
CloudWatch Logs destination policies can be imported using the `destination_name`, e.g.
```
$ terraform import aws_cloudwatch_log_destination_policy.test_destination_policy test_destination
```