opentofu/builtin/providers/aws/resource_aws_opsworks_permission_test.go
Jan Schumann ecb4b5aada providers/aws: Opsworks permission resource (#6304)
* add opsworks permission resource

* add docs

* remove permission from state if the permission object could not be found

* remove nil validate function. validation is done in schema.Resource.

* add id to the list of exported values

* renge over permission to check that we have found got the correct one

* removed comment

* removed set id

* fix unknown region us-east-1c

* add user_profile resource

* add docs

* add default value
2016-07-21 00:29:33 +01:00

42 lines
1.0 KiB
Go

package aws
import (
"testing"
"github.com/hashicorp/terraform/helper/resource"
)
func TestAccAWSOpsworksPermission(t *testing.T) {
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
Steps: []resource.TestStep{
resource.TestStep{
Config: testAccAwsOpsworksPermissionCreate,
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr(
"aws_opsworks_permission.tf-acc-perm", "allow_ssh", "true",
),
resource.TestCheckResourceAttr(
"aws_opsworks_permission.tf-acc-perm", "allow_sudo", "true",
),
resource.TestCheckResourceAttr(
"aws_opsworks_permission.tf-acc-perm", "level", "iam_only",
),
),
},
},
})
}
var testAccAwsOpsworksPermissionCreate = testAccAwsOpsworksUserProfileCreate + `
resource "aws_opsworks_permission" "tf-acc-perm" {
stack_id = "${aws_opsworks_stack.tf-acc.id}"
allow_ssh = true
allow_sudo = true
user_arn = "${aws_opsworks_user_profile.user.user_arn}"
level = "iam_only"
}
`