Sha256: 0c6ea690b4d095a39a1962d5fd1aa12060293918c5734f3f8ebf0b7066e48c54

Contents?: true

Size: 1.27 KB

Versions: 131

Compression:

Stored size: 1.27 KB

Contents

### exist

```ruby
describe iam_role('my-iam-role') do
  it { should exist }
end
```

### be_allowed_action

```ruby
describe iam_role('my-iam-role') do
  it { should be_allowed_action('ec2:DescribeInstances') }
  it { should be_allowed_action('s3:Put*').resource_arn('arn:aws:s3:::my-bucket-name/*') }
end
```

### have_iam_policy

```ruby
describe iam_role('my-iam-role') do
  it { should have_iam_policy('ReadOnlyAccess') }
end
```

### have_inline_policy

```ruby
describe iam_role('my-iam-role') do
  it { should have_inline_policy('AllowS3BucketAccess') }
  it do
    should have_inline_policy('AllowS3BucketAccess').policy_document(<<-'DOC')
{
"Statement": [
    {
     "Action": [
        "s3:ListAllMyBuckets"
      ],
      "Effect": "Allow",
      "Resource": "arn:aws:s3:::*"
    },
    {
      "Action": "s3:*",
      "Effect": "Allow",
      "Resource": ["arn:aws:s3:::my-bucket", "arn:aws:s3:::my-bucket/*"]
    }
  ]
}
DOC
  end
end
```

### advanced

`iam_role` can use `Aws::IAM::Role` resource (see http://docs.aws.amazon.com/sdkforruby/api/Aws/IAM/Role.html).

```ruby
describe iam_role('my-iam-role') do
  its('attached_policies.count') { should eq 5 }
end
```

or

```ruby
describe iam_role('my-iam-role') do
  its('resource.attached_policies.count') { should eq 5 }
end
```

Version data entries

131 entries across 131 versions & 2 rubygems

Version Path
awspec-1.15.2 doc/_resource_types/iam_role.md
awspec-1.15.1 doc/_resource_types/iam_role.md
awspec-1.15.0 doc/_resource_types/iam_role.md
awspec-1.14.1 doc/_resource_types/iam_role.md
awspec-1.14.0 doc/_resource_types/iam_role.md
awspec-1.13.0 doc/_resource_types/iam_role.md
awspec-1.12.7 doc/_resource_types/iam_role.md
awspec-1.12.6 doc/_resource_types/iam_role.md
awspec-1.12.5 doc/_resource_types/iam_role.md
awspec-1.12.4 doc/_resource_types/iam_role.md
awspec-1.12.3 doc/_resource_types/iam_role.md
awspec-1.12.2 doc/_resource_types/iam_role.md
awspec-1.12.1 doc/_resource_types/iam_role.md
awspec-1.12.0 doc/_resource_types/iam_role.md
awspec-1.11.1 doc/_resource_types/iam_role.md
awspec-1.11.0 doc/_resource_types/iam_role.md
awspec-1.10.0 doc/_resource_types/iam_role.md
awspec-1.9.0 doc/_resource_types/iam_role.md
awspec-1.8.0 doc/_resource_types/iam_role.md
awspec-1.7.0 doc/_resource_types/iam_role.md