Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Add import functionality to CodeBuild Project #4976

Merged
merged 4 commits into from
Jun 25, 2018
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions aws/import_aws_codebuild_project_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
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,
ImportStateVerifyIgnore: []string{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm guessing this was copy-paste from another resource's testing? 😄 The attributes force_destroy and acl do not exist for this resource, so the whole ImportStateVerifyIgnore bit can be removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I'm sorry. This is my first code-reading terraform, so I referenced s3 bucket or something...
There is no acl for code build indeed, I'm embarrassed. 😓

"force_destroy", "acl"},
},
},
})
}
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{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please document the new import support at the bottom of website/docs/r/codebuild_project.html.markdown? Feel free to copy-paste an existing ## Import section from another resource and adjust appropriately.

State: schema.ImportStatePassthrough,
},

Schema: map[string]*schema.Schema{
"artifacts": {
Expand Down