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/awserr"
"github.com/aws/aws-sdk-go/service/devicefarm"
"github.com/hashicorp/terraform/helper/acctest"
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/terraform"
)
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
beforeInt := acctest.RandInt()
afterInt := acctest.RandInt()
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckDeviceFarmProjectDestroy,
Steps: []resource.TestStep{
resource.TestStep{
Config: testAccDeviceFarmProjectConfig,
{
Config: testAccDeviceFarmProjectConfig(beforeInt),
Check: resource.ComposeTestCheckFunc(
testAccCheckDeviceFarmProjectExists(
"aws_devicefarm_project.foo", &afterCreate),
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(
testAccCheckDeviceFarmProjectExists(
"aws_devicefarm_project.foo", &afterUpdate),
resource.TestCheckResourceAttr(
"aws_devicefarm_project.foo", "name", "tf-testproject-02"),
"aws_devicefarm_project.foo", "name", fmt.Sprintf("tf-testproject-%d", afterInt)),
testAccCheckDeviceFarmProjectNotRecreated(
t, &afterCreate, &afterUpdate),
),
@ -119,35 +103,17 @@ func testAccCheckDeviceFarmProjectDestroy(s *terraform.State) error {
return nil
}
// Verify the error is what we want
dferr, ok := err.(awserr.Error)
if !ok {
return err
}
if dferr.Code() != "DeviceFarmProjectNotFoundFault" {
return err
if dferr, ok := err.(awserr.Error); ok && dferr.Code() == "DeviceFarmProjectNotFoundFault" {
return nil
}
}
return nil
}
const testAccDeviceFarmProjectConfig = `
provider "aws" {
region = "us-west-2"
}
func testAccDeviceFarmProjectConfig(rInt int) string {
return fmt.Sprintf(`
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
---
# aws\_devicefarm\_project
# aws_devicefarm_project
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.
@ -19,18 +19,19 @@ For more information about Device Farm Projects, see the AWS Documentation on
```hcl
resource "aws_devicefarm_project" "awesome_devices"
resource "aws_devicefarm_project" "awesome_devices" {
name = "my-device-farm"
}
```
## Argument Reference
There are currently no other arguments besides the name supported.
* `name` - (Required) The name of the project
## Attributes Reference
The following attributes are exported:
* `name` - The name of the project
* `arn` - The Amazon Resource Name of this project (computed)
* `arn` - The Amazon Resource Name of this project
[aws-get-project]: http://docs.aws.amazon.com/devicefarm/latest/APIReference/API_GetProject.html

View File

@ -422,6 +422,15 @@
</ul>
</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") %>>
<a href="#">Directory Service Resources</a>
<ul class="nav nav-visible">