Skip to content

Commit

Permalink
Make google_logging_project_sink resource importable (#688)
Browse files Browse the repository at this point in the history
  • Loading branch information
pdecat authored and danawillow committed Nov 7, 2017
1 parent ca51efa commit af0a22f
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 0 deletions.
31 changes: 31 additions & 0 deletions google/import_logging_project_sink_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package google

import (
"testing"

"github.com/hashicorp/terraform/helper/acctest"
"github.com/hashicorp/terraform/helper/resource"
)

func TestAccLoggingProjectSink_importBasic(t *testing.T) {
t.Parallel()

sinkName := "tf-test-sink-" + acctest.RandString(10)
bucketName := "tf-test-sink-bucket-" + acctest.RandString(10)

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
Steps: []resource.TestStep{
resource.TestStep{
Config: testAccLoggingProjectSink_basic(sinkName, bucketName),
},

resource.TestStep{
ResourceName: "google_logging_project_sink.basic",
ImportState: true,
ImportStateVerify: true,
},
},
})
}
3 changes: 3 additions & 0 deletions google/resource_logging_project_sink.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ func resourceLoggingProjectSink() *schema.Resource {
Delete: resourceLoggingProjectSinkDelete,
Update: resourceLoggingProjectSinkUpdate,
Schema: resourceLoggingSinkSchema(),
Importer: &schema.ResourceImporter{
State: schema.ImportStatePassthrough,
},
}
schm.Schema["project"] = &schema.Schema{
Type: schema.TypeString,
Expand Down
8 changes: 8 additions & 0 deletions website/docs/r/logging_project_sink.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,11 @@ exported:

* `writer_identity` - The identity associated with this sink. This identity must be granted write access to the
configured `destination`.

## Import

Project-level logging sinks can be imported using their URI, e.g.

```
$ terraform import google_logging_project_sink.my_sink projects/my-project/sinks/my-sink
```

0 comments on commit af0a22f

Please sign in to comment.