Skip to content

Commit

Permalink
Merge pull request #4976 from ryof/master
Browse files Browse the repository at this point in the history
[WIP] Add import functionality to CodeBuild Project
  • Loading branch information
bflad authored Jun 25, 2018
2 parents f68ad0c + 0cbd700 commit 720ca0e
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 0 deletions.
29 changes: 29 additions & 0 deletions aws/import_aws_codebuild_project_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package aws

import (
"testing"

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

func TestAWSCodeBuildProject_importBasic(t *testing.T) {
resourceName := "aws_codebuild_project.test"
rName := acctest.RandomWithPrefix("tf-acc-test")

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckAWSCodeBuildProjectDestroy,
Steps: []resource.TestStep{
{
Config: testAccAWSCodeBuildProjectConfig_basic(rName),
},
{
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
},
},
})
}
3 changes: 3 additions & 0 deletions aws/resource_aws_codebuild_project.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ func resourceAwsCodeBuildProject() *schema.Resource {
Read: resourceAwsCodeBuildProjectRead,
Update: resourceAwsCodeBuildProjectUpdate,
Delete: resourceAwsCodeBuildProjectDelete,
Importer: &schema.ResourceImporter{
State: schema.ImportStatePassthrough,
},

Schema: map[string]*schema.Schema{
"artifacts": {
Expand Down
8 changes: 8 additions & 0 deletions website/docs/r/codebuild_project.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -212,3 +212,11 @@ In addition to all arguments above, the following attributes are exported:

* `id` - The ARN of the CodeBuild project.
* `badge_url` - The URL of the build badge when `badge_enabled` is enabled.

## Import

CodeBuild Project can be imported using the `name`, e.g.

```
$ terraform import aws_codebuild_project.name project-name
```

0 comments on commit 720ca0e

Please sign in to comment.