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.6.1 doc/_resource_types/iam_role.md
awspec-1.6.0 doc/_resource_types/iam_role.md
awspec-1.5.4 doc/_resource_types/iam_role.md
awspec-1.5.3 doc/_resource_types/iam_role.md
awspec-1.5.2 doc/_resource_types/iam_role.md
awspec-1.5.1 doc/_resource_types/iam_role.md
awspec-1.5.0 doc/_resource_types/iam_role.md
awspec-1.4.3 doc/_resource_types/iam_role.md
awspec-1.4.2 doc/_resource_types/iam_role.md
awspec-1.4.1 doc/_resource_types/iam_role.md
awspec-1.4.0 doc/_resource_types/iam_role.md
awspec-1.3.1 doc/_resource_types/iam_role.md
awspec-1.3.0 doc/_resource_types/iam_role.md
awspec-1.2.0 doc/_resource_types/iam_role.md
awspec-1.1.0 doc/_resource_types/iam_role.md
awspec-1.0.0 doc/_resource_types/iam_role.md
awspec-1.0.0.rc doc/_resource_types/iam_role.md
awspec-0.88.2 doc/_resource_types/iam_role.md
awspec-0.88.1 doc/_resource_types/iam_role.md
awspec-0.88.0 doc/_resource_types/iam_role.md