mirror of
https://github.com/letic/terraform-provider-google.git
synced 2024-10-04 17:51:11 +00:00
Make google_logging_project_sink resource importable (#688)
This commit is contained in:
parent
ca51efa7e2
commit
af0a22fbfb
31
google/import_logging_project_sink_test.go
Normal file
31
google/import_logging_project_sink_test.go
Normal file
@ -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,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
@ -15,6 +15,9 @@ func resourceLoggingProjectSink() *schema.Resource {
|
|||||||
Delete: resourceLoggingProjectSinkDelete,
|
Delete: resourceLoggingProjectSinkDelete,
|
||||||
Update: resourceLoggingProjectSinkUpdate,
|
Update: resourceLoggingProjectSinkUpdate,
|
||||||
Schema: resourceLoggingSinkSchema(),
|
Schema: resourceLoggingSinkSchema(),
|
||||||
|
Importer: &schema.ResourceImporter{
|
||||||
|
State: schema.ImportStatePassthrough,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
schm.Schema["project"] = &schema.Schema{
|
schm.Schema["project"] = &schema.Schema{
|
||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
|
@ -118,3 +118,11 @@ exported:
|
|||||||
|
|
||||||
* `writer_identity` - The identity associated with this sink. This identity must be granted write access to the
|
* `writer_identity` - The identity associated with this sink. This identity must be granted write access to the
|
||||||
configured `destination`.
|
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
|
||||||
|
```
|
||||||
|
Loading…
Reference in New Issue
Block a user