diff --git a/builtin/providers/aws/resource_aws_iam_policy_attachment.go b/builtin/providers/aws/resource_aws_iam_policy_attachment.go index cf639b98c..adbd81b20 100644 --- a/builtin/providers/aws/resource_aws_iam_policy_attachment.go +++ b/builtin/providers/aws/resource_aws_iam_policy_attachment.go @@ -25,6 +25,13 @@ func resourceAwsIamPolicyAttachment() *schema.Resource { Type: schema.TypeString, Required: true, ForceNew: true, + ValidateFunc: func(v interface{}, k string) (ws []string, errors []error) { + if v.(string) == "" { + errors = append(errors, fmt.Errorf( + "%q cannot be an empty string", k)) + } + return + }, }, "users": &schema.Schema{ Type: schema.TypeSet, diff --git a/website/source/docs/providers/aws/r/iam_policy_attachment.html.markdown b/website/source/docs/providers/aws/r/iam_policy_attachment.html.markdown index a34fe242a..791311226 100644 --- a/website/source/docs/providers/aws/r/iam_policy_attachment.html.markdown +++ b/website/source/docs/providers/aws/r/iam_policy_attachment.html.markdown @@ -42,7 +42,7 @@ resource "aws_iam_policy_attachment" "test-attach" { The following arguments are supported: -* `name` (Required) - The name of the policy. +* `name` (Required) - The name of the policy. This cannot be an empty string. * `users` (Optional) - The user(s) the policy should be applied to * `roles` (Optional) - The role(s) the policy should be applied to * `groups` (Optional) - The group(s) the policy should be applied to