provider/aws: Add AWS devicefarm docs to AWS navbar

This commit is contained in:
stack72 2017-05-11 14:53:22 +03:00
parent 4942c4d44d
commit dc00c6bc09
No known key found for this signature in database
GPG Key ID: 8619A619B085CB16
3 changed files with 30 additions and 54 deletions

View File

@ -7,54 +7,38 @@ import (
"github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/service/devicefarm" "github.com/aws/aws-sdk-go/service/devicefarm"
"github.com/hashicorp/terraform/helper/acctest"
"github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/terraform" "github.com/hashicorp/terraform/terraform"
) )
func TestAccAWSDeviceFarmProject_basic(t *testing.T) { func TestAccAWSDeviceFarmProject_basic(t *testing.T) {
var v devicefarm.Project
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckDeviceFarmProjectDestroy,
Steps: []resource.TestStep{
resource.TestStep{
Config: testAccDeviceFarmProjectConfig,
Check: resource.ComposeTestCheckFunc(
testAccCheckDeviceFarmProjectExists(
"aws_devicefarm_project.foo", &v),
),
},
},
})
}
func TestAccAWSDeviceFarmProject_update(t *testing.T) {
var afterCreate, afterUpdate devicefarm.Project var afterCreate, afterUpdate devicefarm.Project
beforeInt := acctest.RandInt()
afterInt := acctest.RandInt()
resource.Test(t, resource.TestCase{ resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) }, PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders, Providers: testAccProviders,
CheckDestroy: testAccCheckDeviceFarmProjectDestroy, CheckDestroy: testAccCheckDeviceFarmProjectDestroy,
Steps: []resource.TestStep{ Steps: []resource.TestStep{
resource.TestStep{ {
Config: testAccDeviceFarmProjectConfig, Config: testAccDeviceFarmProjectConfig(beforeInt),
Check: resource.ComposeTestCheckFunc( Check: resource.ComposeTestCheckFunc(
testAccCheckDeviceFarmProjectExists( testAccCheckDeviceFarmProjectExists(
"aws_devicefarm_project.foo", &afterCreate), "aws_devicefarm_project.foo", &afterCreate),
resource.TestCheckResourceAttr( resource.TestCheckResourceAttr(
"aws_devicefarm_project.foo", "name", "tf-testproject-01"), "aws_devicefarm_project.foo", "name", fmt.Sprintf("tf-testproject-%d", beforeInt)),
), ),
}, },
resource.TestStep{ {
Config: testAccDeviceFarmProjectConfigUpdate, Config: testAccDeviceFarmProjectConfig(afterInt),
Check: resource.ComposeTestCheckFunc( Check: resource.ComposeTestCheckFunc(
testAccCheckDeviceFarmProjectExists( testAccCheckDeviceFarmProjectExists(
"aws_devicefarm_project.foo", &afterUpdate), "aws_devicefarm_project.foo", &afterUpdate),
resource.TestCheckResourceAttr( resource.TestCheckResourceAttr(
"aws_devicefarm_project.foo", "name", "tf-testproject-02"), "aws_devicefarm_project.foo", "name", fmt.Sprintf("tf-testproject-%d", afterInt)),
testAccCheckDeviceFarmProjectNotRecreated( testAccCheckDeviceFarmProjectNotRecreated(
t, &afterCreate, &afterUpdate), t, &afterCreate, &afterUpdate),
), ),
@ -119,35 +103,17 @@ func testAccCheckDeviceFarmProjectDestroy(s *terraform.State) error {
return nil return nil
} }
// Verify the error is what we want if dferr, ok := err.(awserr.Error); ok && dferr.Code() == "DeviceFarmProjectNotFoundFault" {
dferr, ok := err.(awserr.Error) return nil
if !ok {
return err
}
if dferr.Code() != "DeviceFarmProjectNotFoundFault" {
return err
} }
} }
return nil return nil
} }
const testAccDeviceFarmProjectConfig = ` func testAccDeviceFarmProjectConfig(rInt int) string {
provider "aws" { return fmt.Sprintf(`
region = "us-west-2"
}
resource "aws_devicefarm_project" "foo" { resource "aws_devicefarm_project" "foo" {
name = "tf-testproject-01" name = "tf-testproject-%d"
}`, rInt)
} }
`
const testAccDeviceFarmProjectConfigUpdate = `
provider "aws" {
region = "us-west-2"
}
resource "aws_devicefarm_project" "foo" {
name = "tf-testproject-02"
}
`

View File

@ -6,7 +6,7 @@ description: |-
Provides a Devicefarm project Provides a Devicefarm project
--- ---
# aws\_devicefarm\_project # aws_devicefarm_project
Provides a resource to manage AWS Device Farm Projects. Provides a resource to manage AWS Device Farm Projects.
Please keep in mind that this feature is only supported on the "us-west-2" region. Please keep in mind that this feature is only supported on the "us-west-2" region.
@ -19,18 +19,19 @@ For more information about Device Farm Projects, see the AWS Documentation on
```hcl ```hcl
resource "aws_devicefarm_project" "awesome_devices" resource "aws_devicefarm_project" "awesome_devices" {
name = "my-device-farm"
}
``` ```
## Argument Reference ## Argument Reference
There are currently no other arguments besides the name supported. * `name` - (Required) The name of the project
## Attributes Reference ## Attributes Reference
The following attributes are exported: The following attributes are exported:
* `name` - The name of the project * `arn` - The Amazon Resource Name of this project
* `arn` - The Amazon Resource Name of this project (computed)
[aws-get-project]: http://docs.aws.amazon.com/devicefarm/latest/APIReference/API_GetProject.html [aws-get-project]: http://docs.aws.amazon.com/devicefarm/latest/APIReference/API_GetProject.html

View File

@ -422,6 +422,15 @@
</ul> </ul>
</li> </li>
<li<%= sidebar_current("docs-aws-resource-devicefarm") %>>
<a href="#">Device Farm Resources</a>
<ul class="nav nav-visible">
<li<%= sidebar_current("docs-aws-resource-devicefarm-project") %>>
<a href="/docs/providers/aws/r/devicefarm_project.html">aws_devicefarm_project</a>
</li>
</ul>
</li>
<li<%= sidebar_current("docs-aws-resource-directory-service") %>> <li<%= sidebar_current("docs-aws-resource-directory-service") %>>
<a href="#">Directory Service Resources</a> <a href="#">Directory Service Resources</a>
<ul class="nav nav-visible"> <ul class="nav nav-visible">