Skip to content

Commit

Permalink
Add import support to consul_intention (#225)
Browse files Browse the repository at this point in the history
Closes #222
  • Loading branch information
remilapeyre committed Sep 14, 2020
1 parent 09c2814 commit 37d9b84
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
3 changes: 3 additions & 0 deletions consul/resource_consul_intention.go
Expand Up @@ -14,6 +14,9 @@ func resourceConsulIntention() *schema.Resource {
Update: resourceConsulIntentionUpdate,
Read: resourceConsulIntentionRead,
Delete: resourceConsulIntentionDelete,
Importer: &schema.ResourceImporter{
State: schema.ImportStatePassthrough,
},

Schema: map[string]*schema.Schema{
"source_name": {
Expand Down
8 changes: 7 additions & 1 deletion consul/resource_consul_intention_test.go
Expand Up @@ -41,6 +41,12 @@ func TestAccConsulIntention_basic(t *testing.T) {
resource.TestCheckResourceAttr("consul_intention.example", "meta.baz", "bat"),
),
},
{
Config: testAccConsulIntentionConfigBasic,
ResourceName: "consul_intention.example",
ImportState: true,
ImportStateVerify: true,
},
},
})
}
Expand Down Expand Up @@ -93,7 +99,7 @@ func testAccCheckConsulIntentionDestroy(s *terraform.State) error {
}

if len(intentions) > 0 {
return fmt.Errorf("Intentions still exsist: %v", intentions)
return fmt.Errorf("Intentions still exist: %v", intentions)
}

return nil
Expand Down
8 changes: 8 additions & 0 deletions website/docs/r/intention.html.markdown
Expand Up @@ -82,3 +82,11 @@ The following attributes are exported:
* `description` - A description of the intention.
* `meta` - Key/value pairs associated with the intention.
* `datacenter` - The datacenter in which the intention is created.

## Import

`consul_intention` can be imported:

```
$ terraform import consul_intention.database 657a57d6-0d56-57e2-31cb-e9f1ed3c18dd
```

0 comments on commit 37d9b84

Please sign in to comment.