Add import functionality
This commit is contained in:
parent
a08fbcbadb
commit
3939a7220d
|
@ -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,
|
||||||
|
|
|
@ -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,
|
||||||
|
|
|
@ -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
|
||||||
|
```
|
||||||
|
|
|
@ -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
|
||||||
|
```
|
||||||
|
|
Loading…
Reference in New Issue