From f09ceab3783fb14f01f210d34b2acf5efd5bbad8 Mon Sep 17 00:00:00 2001 From: particleflux Date: Tue, 1 Sep 2020 22:11:48 +0200 Subject: [PATCH] Allow importing of projects Add an importer to the `bitbucket_project` resource. Fixes #68 --- bitbucket/resource_project.go | 3 +++ website/docs/r/project.html.markdown | 10 +++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/bitbucket/resource_project.go b/bitbucket/resource_project.go index c89e40ab..b1be456f 100644 --- a/bitbucket/resource_project.go +++ b/bitbucket/resource_project.go @@ -26,6 +26,9 @@ func resourceProject() *schema.Resource { Update: resourceProjectUpdate, Read: resourceProjectRead, Delete: resourceProjectDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, Schema: map[string]*schema.Schema{ "key": { diff --git a/website/docs/r/project.html.markdown b/website/docs/r/project.html.markdown index c6a866c4..af7b5d8f 100644 --- a/website/docs/r/project.html.markdown +++ b/website/docs/r/project.html.markdown @@ -30,4 +30,12 @@ The following arguments are supported: * `name` - (Required) The name of the project * `key` - (Required) The key used for this project * `description` - (Optional) The description of the project -* `is_private` - (Optional) If you want to keep the project private - defaults to true \ No newline at end of file +* `is_private` - (Optional) If you want to keep the project private - defaults to true + +## Import + +Projects can be imported using their `owner/name` ID, e.g. + +``` +$ terraform import bitbucket_project.my-repo my-account/my-project +```