cthiesfork-awspec 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (497) hide show
  1. checksums.yaml +7 -0
  2. data/.editorconfig +12 -0
  3. data/.rubocop.yml +93 -0
  4. data/.tachikoma.yml +1 -0
  5. data/.travis.yml +21 -0
  6. data/Gemfile +4 -0
  7. data/LICENSE.txt +21 -0
  8. data/README.md +191 -0
  9. data/Rakefile +64 -0
  10. data/awspec-logo.png +0 -0
  11. data/awspec.gemspec +37 -0
  12. data/bin/console +7 -0
  13. data/bin/setup +5 -0
  14. data/bin/toolbox +5 -0
  15. data/doc/_resource_types/acm.md +24 -0
  16. data/doc/_resource_types/alb.md +47 -0
  17. data/doc/_resource_types/alb_listener.md +29 -0
  18. data/doc/_resource_types/alb_target_group.md +35 -0
  19. data/doc/_resource_types/ami.md +19 -0
  20. data/doc/_resource_types/apigateway.md +7 -0
  21. data/doc/_resource_types/autoscaling_group.md +47 -0
  22. data/doc/_resource_types/batch_compute_environment.md +23 -0
  23. data/doc/_resource_types/batch_job_definition.md +7 -0
  24. data/doc/_resource_types/batch_job_queue.md +23 -0
  25. data/doc/_resource_types/cloudformation_stack.md +8 -0
  26. data/doc/_resource_types/cloudfront_distribution.md +67 -0
  27. data/doc/_resource_types/cloudtrail.md +47 -0
  28. data/doc/_resource_types/cloudwatch_alarm.md +39 -0
  29. data/doc/_resource_types/cloudwatch_logs.md +48 -0
  30. data/doc/_resource_types/codebuild.md +1 -0
  31. data/doc/_resource_types/codedeploy.md +1 -0
  32. data/doc/_resource_types/codedeploy_deployment_group.md +17 -0
  33. data/doc/_resource_types/customer_gateway.md +25 -0
  34. data/doc/_resource_types/directconnect_virtual_interface.md +30 -0
  35. data/doc/_resource_types/dynamodb_table.md +52 -0
  36. data/doc/_resource_types/ebs.md +49 -0
  37. data/doc/_resource_types/ec2.md +203 -0
  38. data/doc/_resource_types/ec2_account_attributes.md +8 -0
  39. data/doc/_resource_types/ecs_cluster.md +23 -0
  40. data/doc/_resource_types/ecs_container_instance.md +18 -0
  41. data/doc/_resource_types/ecs_service.md +15 -0
  42. data/doc/_resource_types/ecs_task_definition.md +15 -0
  43. data/doc/_resource_types/efs.md +15 -0
  44. data/doc/_resource_types/eip.md +23 -0
  45. data/doc/_resource_types/eks.md +14 -0
  46. data/doc/_resource_types/elasticache.md +57 -0
  47. data/doc/_resource_types/elasticache_cache_parameter_group.md +17 -0
  48. data/doc/_resource_types/elasticsearch.md +48 -0
  49. data/doc/_resource_types/elastictranscoder_pipeline.md +15 -0
  50. data/doc/_resource_types/elb.md +82 -0
  51. data/doc/_resource_types/emr.md +21 -0
  52. data/doc/_resource_types/firehose.md +31 -0
  53. data/doc/_resource_types/iam_group.md +94 -0
  54. data/doc/_resource_types/iam_policy.md +39 -0
  55. data/doc/_resource_types/iam_role.md +78 -0
  56. data/doc/_resource_types/iam_user.md +86 -0
  57. data/doc/_resource_types/internet_gateway.md +31 -0
  58. data/doc/_resource_types/kinesis.md +7 -0
  59. data/doc/_resource_types/kms.md +70 -0
  60. data/doc/_resource_types/lambda.md +40 -0
  61. data/doc/_resource_types/lambda_account_settings.md +10 -0
  62. data/doc/_resource_types/launch_configuration.md +15 -0
  63. data/doc/_resource_types/launch_template.md +48 -0
  64. data/doc/_resource_types/mq.md +33 -0
  65. data/doc/_resource_types/nat_gateway.md +39 -0
  66. data/doc/_resource_types/network_acl.md +61 -0
  67. data/doc/_resource_types/network_interface.md +66 -0
  68. data/doc/_resource_types/nlb.md +41 -0
  69. data/doc/_resource_types/nlb_listener.md +29 -0
  70. data/doc/_resource_types/nlb_target_group.md +35 -0
  71. data/doc/_resource_types/rds.md +100 -0
  72. data/doc/_resource_types/rds_account_attributes.md +8 -0
  73. data/doc/_resource_types/rds_db_cluster_parameter_group.md +16 -0
  74. data/doc/_resource_types/rds_db_parameter_group.md +15 -0
  75. data/doc/_resource_types/redshift.md +61 -0
  76. data/doc/_resource_types/redshift_cluster_parameter_group.md +17 -0
  77. data/doc/_resource_types/route53_hosted_zone.md +27 -0
  78. data/doc/_resource_types/route_table.md +60 -0
  79. data/doc/_resource_types/s3_bucket.md +158 -0
  80. data/doc/_resource_types/secretsmanager.md +15 -0
  81. data/doc/_resource_types/security_group.md +44 -0
  82. data/doc/_resource_types/ses_identity.md +17 -0
  83. data/doc/_resource_types/ses_send_quota.md +9 -0
  84. data/doc/_resource_types/sns_topic.md +134 -0
  85. data/doc/_resource_types/sqs.md +7 -0
  86. data/doc/_resource_types/ssm_parameter.md +33 -0
  87. data/doc/_resource_types/subnet.md +41 -0
  88. data/doc/_resource_types/vpc.md +88 -0
  89. data/doc/_resource_types/vpn_connection.md +25 -0
  90. data/doc/_resource_types/vpn_gateway.md +25 -0
  91. data/doc/_resource_types/waf_web_acl.md +29 -0
  92. data/doc/_resource_types/wafregional_web_acl.md +29 -0
  93. data/doc/contributing.md +45 -0
  94. data/doc/resource_types.md +3852 -0
  95. data/exe/awspec +5 -0
  96. data/lib/awspec.rb +23 -0
  97. data/lib/awspec/cli.rb +25 -0
  98. data/lib/awspec/command/generate.rb +69 -0
  99. data/lib/awspec/config.rb +41 -0
  100. data/lib/awspec/error.rb +32 -0
  101. data/lib/awspec/ext.rb +4 -0
  102. data/lib/awspec/ext/array.rb +8 -0
  103. data/lib/awspec/ext/hash.rb +10 -0
  104. data/lib/awspec/ext/string.rb +17 -0
  105. data/lib/awspec/ext/struct.rb +8 -0
  106. data/lib/awspec/generator.rb +55 -0
  107. data/lib/awspec/generator/doc/type.rb +60 -0
  108. data/lib/awspec/generator/doc/type/account.rb +71 -0
  109. data/lib/awspec/generator/doc/type/account_attribute.rb +69 -0
  110. data/lib/awspec/generator/doc/type/account_attribute_base.rb +32 -0
  111. data/lib/awspec/generator/doc/type/acm.rb +19 -0
  112. data/lib/awspec/generator/doc/type/alb.rb +21 -0
  113. data/lib/awspec/generator/doc/type/alb_listener.rb +18 -0
  114. data/lib/awspec/generator/doc/type/alb_target_group.rb +17 -0
  115. data/lib/awspec/generator/doc/type/ami.rb +19 -0
  116. data/lib/awspec/generator/doc/type/apigateway.rb +17 -0
  117. data/lib/awspec/generator/doc/type/autoscaling_group.rb +16 -0
  118. data/lib/awspec/generator/doc/type/base.rb +99 -0
  119. data/lib/awspec/generator/doc/type/batch_compute_environment.rb +23 -0
  120. data/lib/awspec/generator/doc/type/batch_job_definition.rb +17 -0
  121. data/lib/awspec/generator/doc/type/batch_job_queue.rb +17 -0
  122. data/lib/awspec/generator/doc/type/cloudformation_stack.rb +17 -0
  123. data/lib/awspec/generator/doc/type/cloudfront_distribution.rb +20 -0
  124. data/lib/awspec/generator/doc/type/cloudtrail.rb +17 -0
  125. data/lib/awspec/generator/doc/type/cloudwatch_alarm.rb +17 -0
  126. data/lib/awspec/generator/doc/type/cloudwatch_event.rb +17 -0
  127. data/lib/awspec/generator/doc/type/cloudwatch_logs.rb +17 -0
  128. data/lib/awspec/generator/doc/type/codebuild.rb +17 -0
  129. data/lib/awspec/generator/doc/type/codedeploy.rb +17 -0
  130. data/lib/awspec/generator/doc/type/codedeploy_deployment_group.rb +17 -0
  131. data/lib/awspec/generator/doc/type/customer_gateway.rb +19 -0
  132. data/lib/awspec/generator/doc/type/directconnect_virtual_interface.rb +21 -0
  133. data/lib/awspec/generator/doc/type/dynamodb_table.rb +19 -0
  134. data/lib/awspec/generator/doc/type/ebs.rb +19 -0
  135. data/lib/awspec/generator/doc/type/ec2.rb +21 -0
  136. data/lib/awspec/generator/doc/type/ec2_account_attributes.rb +17 -0
  137. data/lib/awspec/generator/doc/type/ecr_repository.rb +15 -0
  138. data/lib/awspec/generator/doc/type/ecs_cluster.rb +19 -0
  139. data/lib/awspec/generator/doc/type/ecs_container_instance.rb +19 -0
  140. data/lib/awspec/generator/doc/type/ecs_service.rb +19 -0
  141. data/lib/awspec/generator/doc/type/ecs_task_definition.rb +19 -0
  142. data/lib/awspec/generator/doc/type/efs.rb +17 -0
  143. data/lib/awspec/generator/doc/type/eip.rb +17 -0
  144. data/lib/awspec/generator/doc/type/eks.rb +20 -0
  145. data/lib/awspec/generator/doc/type/elasticache.rb +22 -0
  146. data/lib/awspec/generator/doc/type/elasticache_cache_parameter_group.rb +17 -0
  147. data/lib/awspec/generator/doc/type/elasticsearch.rb +17 -0
  148. data/lib/awspec/generator/doc/type/elastictranscoder_pipeline.rb +21 -0
  149. data/lib/awspec/generator/doc/type/elb.rb +21 -0
  150. data/lib/awspec/generator/doc/type/emr.rb +19 -0
  151. data/lib/awspec/generator/doc/type/firehose.rb +17 -0
  152. data/lib/awspec/generator/doc/type/iam_group.rb +17 -0
  153. data/lib/awspec/generator/doc/type/iam_policy.rb +17 -0
  154. data/lib/awspec/generator/doc/type/iam_role.rb +17 -0
  155. data/lib/awspec/generator/doc/type/iam_user.rb +17 -0
  156. data/lib/awspec/generator/doc/type/internet_gateway.rb +17 -0
  157. data/lib/awspec/generator/doc/type/kinesis.rb +17 -0
  158. data/lib/awspec/generator/doc/type/kms.rb +17 -0
  159. data/lib/awspec/generator/doc/type/lambda.rb +17 -0
  160. data/lib/awspec/generator/doc/type/lambda_account_settings.rb +17 -0
  161. data/lib/awspec/generator/doc/type/launch_configuration.rb +17 -0
  162. data/lib/awspec/generator/doc/type/launch_template.rb +17 -0
  163. data/lib/awspec/generator/doc/type/mq.rb +19 -0
  164. data/lib/awspec/generator/doc/type/nat_gateway.rb +20 -0
  165. data/lib/awspec/generator/doc/type/network_acl.rb +20 -0
  166. data/lib/awspec/generator/doc/type/network_interface.rb +21 -0
  167. data/lib/awspec/generator/doc/type/nlb.rb +20 -0
  168. data/lib/awspec/generator/doc/type/nlb_listener.rb +18 -0
  169. data/lib/awspec/generator/doc/type/nlb_target_group.rb +17 -0
  170. data/lib/awspec/generator/doc/type/rds.rb +22 -0
  171. data/lib/awspec/generator/doc/type/rds_account_attributes.rb +17 -0
  172. data/lib/awspec/generator/doc/type/rds_db_cluster_parameter_group.rb +15 -0
  173. data/lib/awspec/generator/doc/type/rds_db_parameter_group.rb +15 -0
  174. data/lib/awspec/generator/doc/type/redshift.rb +21 -0
  175. data/lib/awspec/generator/doc/type/redshift_cluster_parameter_group.rb +17 -0
  176. data/lib/awspec/generator/doc/type/route53_hosted_zone.rb +16 -0
  177. data/lib/awspec/generator/doc/type/route_table.rb +16 -0
  178. data/lib/awspec/generator/doc/type/s3_bucket.rb +16 -0
  179. data/lib/awspec/generator/doc/type/secretsmanager.rb +17 -0
  180. data/lib/awspec/generator/doc/type/security_group.rb +16 -0
  181. data/lib/awspec/generator/doc/type/ses_identity.rb +22 -0
  182. data/lib/awspec/generator/doc/type/ses_send_quota.rb +17 -0
  183. data/lib/awspec/generator/doc/type/sns_topic.rb +18 -0
  184. data/lib/awspec/generator/doc/type/sqs.rb +17 -0
  185. data/lib/awspec/generator/doc/type/ssm_parameter.rb +17 -0
  186. data/lib/awspec/generator/doc/type/subnet.rb +18 -0
  187. data/lib/awspec/generator/doc/type/vpc.rb +19 -0
  188. data/lib/awspec/generator/doc/type/vpn_connection.rb +19 -0
  189. data/lib/awspec/generator/doc/type/vpn_gateway.rb +19 -0
  190. data/lib/awspec/generator/doc/type/waf_web_acl.rb +17 -0
  191. data/lib/awspec/generator/doc/type/wafregional_web_acl.rb +17 -0
  192. data/lib/awspec/generator/spec/acm.rb +43 -0
  193. data/lib/awspec/generator/spec/alb.rb +38 -0
  194. data/lib/awspec/generator/spec/alb_listener.rb +110 -0
  195. data/lib/awspec/generator/spec/autoscaling_group.rb +56 -0
  196. data/lib/awspec/generator/spec/cloudwatch_alarm.rb +43 -0
  197. data/lib/awspec/generator/spec/cloudwatch_event.rb +27 -0
  198. data/lib/awspec/generator/spec/cloudwatch_logs.rb +68 -0
  199. data/lib/awspec/generator/spec/codebuild.rb +23 -0
  200. data/lib/awspec/generator/spec/directconnect.rb +33 -0
  201. data/lib/awspec/generator/spec/ebs.rb +55 -0
  202. data/lib/awspec/generator/spec/ec2.rb +82 -0
  203. data/lib/awspec/generator/spec/efs.rb +28 -0
  204. data/lib/awspec/generator/spec/eip.rb +30 -0
  205. data/lib/awspec/generator/spec/elasticsearch.rb +41 -0
  206. data/lib/awspec/generator/spec/elb.rb +59 -0
  207. data/lib/awspec/generator/spec/iam_group.rb +39 -0
  208. data/lib/awspec/generator/spec/iam_policy.rb +56 -0
  209. data/lib/awspec/generator/spec/iam_role.rb +39 -0
  210. data/lib/awspec/generator/spec/iam_user.rb +39 -0
  211. data/lib/awspec/generator/spec/internet_gateway.rb +35 -0
  212. data/lib/awspec/generator/spec/kms.rb +34 -0
  213. data/lib/awspec/generator/spec/lambda.rb +29 -0
  214. data/lib/awspec/generator/spec/nat_gateway.rb +39 -0
  215. data/lib/awspec/generator/spec/network_acl.rb +96 -0
  216. data/lib/awspec/generator/spec/network_interface.rb +80 -0
  217. data/lib/awspec/generator/spec/nlb.rb +38 -0
  218. data/lib/awspec/generator/spec/nlb_listener.rb +110 -0
  219. data/lib/awspec/generator/spec/rds.rb +62 -0
  220. data/lib/awspec/generator/spec/rds_db_cluster_parameter_group.rb +23 -0
  221. data/lib/awspec/generator/spec/rds_db_parameter_group.rb +23 -0
  222. data/lib/awspec/generator/spec/redshift.rb +65 -0
  223. data/lib/awspec/generator/spec/redshift_cluster_parameter_group.rb +23 -0
  224. data/lib/awspec/generator/spec/route53_hosted_zone.rb +72 -0
  225. data/lib/awspec/generator/spec/route_table.rb +128 -0
  226. data/lib/awspec/generator/spec/s3_bucket.rb +124 -0
  227. data/lib/awspec/generator/spec/security_group.rb +95 -0
  228. data/lib/awspec/generator/spec/subnet.rb +47 -0
  229. data/lib/awspec/generator/spec/vpc.rb +65 -0
  230. data/lib/awspec/generator/template.rb +145 -0
  231. data/lib/awspec/helper.rb +8 -0
  232. data/lib/awspec/helper/client_wrap.rb +49 -0
  233. data/lib/awspec/helper/color.rb +5 -0
  234. data/lib/awspec/helper/finder.rb +168 -0
  235. data/lib/awspec/helper/finder/account_attributes.rb +61 -0
  236. data/lib/awspec/helper/finder/acm.rb +40 -0
  237. data/lib/awspec/helper/finder/alb.rb +68 -0
  238. data/lib/awspec/helper/finder/ami.rb +22 -0
  239. data/lib/awspec/helper/finder/apigateway.rb +35 -0
  240. data/lib/awspec/helper/finder/autoscaling.rb +60 -0
  241. data/lib/awspec/helper/finder/batch.rb +20 -0
  242. data/lib/awspec/helper/finder/cloudformation.rb +12 -0
  243. data/lib/awspec/helper/finder/cloudfront.rb +21 -0
  244. data/lib/awspec/helper/finder/cloudtrail.rb +29 -0
  245. data/lib/awspec/helper/finder/cloudwatch.rb +33 -0
  246. data/lib/awspec/helper/finder/cloudwatch_event.rb +15 -0
  247. data/lib/awspec/helper/finder/cloudwatch_logs.rb +93 -0
  248. data/lib/awspec/helper/finder/codebuild.rb +24 -0
  249. data/lib/awspec/helper/finder/codedeploy.rb +15 -0
  250. data/lib/awspec/helper/finder/directconnect.rb +19 -0
  251. data/lib/awspec/helper/finder/dynamodb.rb +10 -0
  252. data/lib/awspec/helper/finder/ebs.rb +43 -0
  253. data/lib/awspec/helper/finder/ec2.rb +203 -0
  254. data/lib/awspec/helper/finder/ecr.rb +10 -0
  255. data/lib/awspec/helper/finder/ecs.rb +45 -0
  256. data/lib/awspec/helper/finder/efs.rb +63 -0
  257. data/lib/awspec/helper/finder/eks.rb +10 -0
  258. data/lib/awspec/helper/finder/elasticache.rb +21 -0
  259. data/lib/awspec/helper/finder/elasticsearch.rb +19 -0
  260. data/lib/awspec/helper/finder/elastictranscoder.rb +21 -0
  261. data/lib/awspec/helper/finder/elb.rb +37 -0
  262. data/lib/awspec/helper/finder/emr.rb +9 -0
  263. data/lib/awspec/helper/finder/firehose.rb +13 -0
  264. data/lib/awspec/helper/finder/iam.rb +118 -0
  265. data/lib/awspec/helper/finder/kinesis.rb +14 -0
  266. data/lib/awspec/helper/finder/kms.rb +38 -0
  267. data/lib/awspec/helper/finder/lambda.rb +35 -0
  268. data/lib/awspec/helper/finder/mq.rb +11 -0
  269. data/lib/awspec/helper/finder/nlb.rb +68 -0
  270. data/lib/awspec/helper/finder/rds.rb +59 -0
  271. data/lib/awspec/helper/finder/redshift.rb +37 -0
  272. data/lib/awspec/helper/finder/route53.rb +41 -0
  273. data/lib/awspec/helper/finder/s3.rb +80 -0
  274. data/lib/awspec/helper/finder/secretsmanager.rb +11 -0
  275. data/lib/awspec/helper/finder/security_group.rb +35 -0
  276. data/lib/awspec/helper/finder/ses.rb +13 -0
  277. data/lib/awspec/helper/finder/sns_topic.rb +82 -0
  278. data/lib/awspec/helper/finder/sqs.rb +17 -0
  279. data/lib/awspec/helper/finder/ssm_parameter.rb +32 -0
  280. data/lib/awspec/helper/finder/subnet.rb +29 -0
  281. data/lib/awspec/helper/finder/vpc.rb +115 -0
  282. data/lib/awspec/helper/finder/waf.rb +53 -0
  283. data/lib/awspec/helper/finder/wafregional.rb +53 -0
  284. data/lib/awspec/helper/type.rb +72 -0
  285. data/lib/awspec/matcher.rb +85 -0
  286. data/lib/awspec/matcher/be_allowed.rb +25 -0
  287. data/lib/awspec/matcher/be_allowed_action.rb +19 -0
  288. data/lib/awspec/matcher/be_attached_to.rb +19 -0
  289. data/lib/awspec/matcher/be_connected_to_vpc.rb +13 -0
  290. data/lib/awspec/matcher/be_denied.rb +25 -0
  291. data/lib/awspec/matcher/be_opened.rb +17 -0
  292. data/lib/awspec/matcher/be_opened_only.rb +17 -0
  293. data/lib/awspec/matcher/belong_to_alb.rb +8 -0
  294. data/lib/awspec/matcher/belong_to_cache_subnet_group.rb +5 -0
  295. data/lib/awspec/matcher/belong_to_cluster_subnet_group.rb +5 -0
  296. data/lib/awspec/matcher/belong_to_db_subnet_group.rb +5 -0
  297. data/lib/awspec/matcher/belong_to_domain.rb +5 -0
  298. data/lib/awspec/matcher/belong_to_iam_group.rb +8 -0
  299. data/lib/awspec/matcher/belong_to_metric.rb +13 -0
  300. data/lib/awspec/matcher/belong_to_nlb.rb +8 -0
  301. data/lib/awspec/matcher/belong_to_replication_group.rb +6 -0
  302. data/lib/awspec/matcher/belong_to_subnet.rb +31 -0
  303. data/lib/awspec/matcher/belong_to_vpc.rb +8 -0
  304. data/lib/awspec/matcher/have_attribute_definition.rb +9 -0
  305. data/lib/awspec/matcher/have_cluster_parameter_group.rb +9 -0
  306. data/lib/awspec/matcher/have_custom_response_error_code.rb +21 -0
  307. data/lib/awspec/matcher/have_db_parameter_group.rb +9 -0
  308. data/lib/awspec/matcher/have_env_var.rb +9 -0
  309. data/lib/awspec/matcher/have_env_var_value.rb +18 -0
  310. data/lib/awspec/matcher/have_env_vars.rb +5 -0
  311. data/lib/awspec/matcher/have_inline_policy.rb +9 -0
  312. data/lib/awspec/matcher/have_key_policy.rb +9 -0
  313. data/lib/awspec/matcher/have_key_schema.rb +9 -0
  314. data/lib/awspec/matcher/have_network_interface.rb +15 -0
  315. data/lib/awspec/matcher/have_option_group.rb +9 -0
  316. data/lib/awspec/matcher/have_origin.rb +21 -0
  317. data/lib/awspec/matcher/have_private_ip_address.rb +9 -0
  318. data/lib/awspec/matcher/have_record_set.rb +41 -0
  319. data/lib/awspec/matcher/have_route.rb +34 -0
  320. data/lib/awspec/matcher/have_rule.rb +36 -0
  321. data/lib/awspec/matcher/have_subscription_attributes.rb +16 -0
  322. data/lib/awspec/matcher/have_subscription_filter.rb +9 -0
  323. data/lib/awspec/matcher/have_tag.rb +13 -0
  324. data/lib/awspec/matcher/have_vpc_peering_connection.rb +13 -0
  325. data/lib/awspec/matcher/include_subscribed.rb +5 -0
  326. data/lib/awspec/resource_reader.rb +58 -0
  327. data/lib/awspec/setup.rb +84 -0
  328. data/lib/awspec/shared_context.rb +37 -0
  329. data/lib/awspec/stub.rb +7 -0
  330. data/lib/awspec/stub/account.rb +147 -0
  331. data/lib/awspec/stub/acm.rb +34 -0
  332. data/lib/awspec/stub/alb.rb +261 -0
  333. data/lib/awspec/stub/alb_listener.rb +307 -0
  334. data/lib/awspec/stub/alb_target_group.rb +325 -0
  335. data/lib/awspec/stub/ami.rb +58 -0
  336. data/lib/awspec/stub/apigateway.rb +89 -0
  337. data/lib/awspec/stub/autoscaling_group.rb +241 -0
  338. data/lib/awspec/stub/batch_compute_environment.rb +40 -0
  339. data/lib/awspec/stub/batch_job_definition.rb +28 -0
  340. data/lib/awspec/stub/batch_job_queue.rb +22 -0
  341. data/lib/awspec/stub/cloudformation_stack.rb +49 -0
  342. data/lib/awspec/stub/cloudfront_distribution.rb +230 -0
  343. data/lib/awspec/stub/cloudtrail.rb +35 -0
  344. data/lib/awspec/stub/cloudwatch_alarm.rb +40 -0
  345. data/lib/awspec/stub/cloudwatch_event.rb +15 -0
  346. data/lib/awspec/stub/cloudwatch_logs.rb +41 -0
  347. data/lib/awspec/stub/codebuild.rb +10 -0
  348. data/lib/awspec/stub/codedeploy.rb +12 -0
  349. data/lib/awspec/stub/codedeploy_deployment_group.rb +39 -0
  350. data/lib/awspec/stub/customer_gateway.rb +16 -0
  351. data/lib/awspec/stub/directconnect_virtual_interface.rb +25 -0
  352. data/lib/awspec/stub/duplicated_resource_type.rb +26 -0
  353. data/lib/awspec/stub/dynamodb_table.rb +34 -0
  354. data/lib/awspec/stub/ebs.rb +67 -0
  355. data/lib/awspec/stub/ec2.rb +235 -0
  356. data/lib/awspec/stub/ec2_has_multi_security_groups.rb +21 -0
  357. data/lib/awspec/stub/ecr_repository.rb +13 -0
  358. data/lib/awspec/stub/ecs.rb +199 -0
  359. data/lib/awspec/stub/ecs_cluster.rb +99 -0
  360. data/lib/awspec/stub/ecs_container_instance.rb +78 -0
  361. data/lib/awspec/stub/ecs_service.rb +51 -0
  362. data/lib/awspec/stub/ecs_task_definition.rb +58 -0
  363. data/lib/awspec/stub/efs.rb +43 -0
  364. data/lib/awspec/stub/eip.rb +13 -0
  365. data/lib/awspec/stub/eks.rb +28 -0
  366. data/lib/awspec/stub/elasticache.rb +91 -0
  367. data/lib/awspec/stub/elasticache_cache_parameter_group.rb +28 -0
  368. data/lib/awspec/stub/elasticsearch.rb +52 -0
  369. data/lib/awspec/stub/elastictranscoder_pipeline.rb +63 -0
  370. data/lib/awspec/stub/elb.rb +166 -0
  371. data/lib/awspec/stub/emr.rb +65 -0
  372. data/lib/awspec/stub/firehose.rb +24 -0
  373. data/lib/awspec/stub/iam_group.rb +90 -0
  374. data/lib/awspec/stub/iam_policy.rb +70 -0
  375. data/lib/awspec/stub/iam_role.rb +60 -0
  376. data/lib/awspec/stub/iam_user.rb +71 -0
  377. data/lib/awspec/stub/internet_gateway.rb +36 -0
  378. data/lib/awspec/stub/kinesis.rb +37 -0
  379. data/lib/awspec/stub/kms.rb +75 -0
  380. data/lib/awspec/stub/lambda.rb +47 -0
  381. data/lib/awspec/stub/launch_configuration.rb +56 -0
  382. data/lib/awspec/stub/launch_template.rb +16 -0
  383. data/lib/awspec/stub/mq.rb +111 -0
  384. data/lib/awspec/stub/nat_gateway.rb +41 -0
  385. data/lib/awspec/stub/network_acl.rb +97 -0
  386. data/lib/awspec/stub/network_interface.rb +144 -0
  387. data/lib/awspec/stub/nlb.rb +119 -0
  388. data/lib/awspec/stub/nlb_listener.rb +131 -0
  389. data/lib/awspec/stub/nlb_target_group.rb +187 -0
  390. data/lib/awspec/stub/rds.rb +106 -0
  391. data/lib/awspec/stub/rds_db_cluster_parameter_group.rb +20 -0
  392. data/lib/awspec/stub/rds_db_parameter_group.rb +20 -0
  393. data/lib/awspec/stub/redshift.rb +67 -0
  394. data/lib/awspec/stub/redshift_cluster_parameter_group.rb +20 -0
  395. data/lib/awspec/stub/route53_hosted_zone.rb +169 -0
  396. data/lib/awspec/stub/route_table.rb +207 -0
  397. data/lib/awspec/stub/s3_bucket.rb +135 -0
  398. data/lib/awspec/stub/secretsmanager.rb +36 -0
  399. data/lib/awspec/stub/security_group.rb +159 -0
  400. data/lib/awspec/stub/ses_identity.rb +41 -0
  401. data/lib/awspec/stub/sns_topic.rb +29 -0
  402. data/lib/awspec/stub/sqs.rb +30 -0
  403. data/lib/awspec/stub/ssm_parameter.rb +16 -0
  404. data/lib/awspec/stub/subnet.rb +33 -0
  405. data/lib/awspec/stub/vpc.rb +114 -0
  406. data/lib/awspec/stub/vpn_connection.rb +20 -0
  407. data/lib/awspec/stub/vpn_gateway.rb +15 -0
  408. data/lib/awspec/stub/waf_web_acl.rb +62 -0
  409. data/lib/awspec/stub/wafregional_web_acl.rb +62 -0
  410. data/lib/awspec/toolbox.rb +18 -0
  411. data/lib/awspec/type/account.rb +39 -0
  412. data/lib/awspec/type/account_attribute.rb +28 -0
  413. data/lib/awspec/type/account_attribute_base.rb +4 -0
  414. data/lib/awspec/type/acm.rb +41 -0
  415. data/lib/awspec/type/alb.rb +54 -0
  416. data/lib/awspec/type/alb_listener.rb +43 -0
  417. data/lib/awspec/type/alb_target_group.rb +22 -0
  418. data/lib/awspec/type/ami.rb +25 -0
  419. data/lib/awspec/type/apigateway.rb +24 -0
  420. data/lib/awspec/type/autoscaling_group.rb +54 -0
  421. data/lib/awspec/type/base.rb +63 -0
  422. data/lib/awspec/type/batch_compute_environment.rb +32 -0
  423. data/lib/awspec/type/batch_job_definition.rb +16 -0
  424. data/lib/awspec/type/batch_job_queue.rb +31 -0
  425. data/lib/awspec/type/cloudformation_stack.rb +11 -0
  426. data/lib/awspec/type/cloudfront_distribution.rb +60 -0
  427. data/lib/awspec/type/cloudtrail.rb +35 -0
  428. data/lib/awspec/type/cloudwatch_alarm.rb +23 -0
  429. data/lib/awspec/type/cloudwatch_event.rb +19 -0
  430. data/lib/awspec/type/cloudwatch_logs.rb +37 -0
  431. data/lib/awspec/type/codebuild.rb +11 -0
  432. data/lib/awspec/type/codedeploy.rb +11 -0
  433. data/lib/awspec/type/codedeploy_deployment_group.rb +33 -0
  434. data/lib/awspec/type/customer_gateway.rb +40 -0
  435. data/lib/awspec/type/directconnect_virtual_interface.rb +27 -0
  436. data/lib/awspec/type/dynamodb_table.rb +40 -0
  437. data/lib/awspec/type/ebs.rb +37 -0
  438. data/lib/awspec/type/ec2.rb +154 -0
  439. data/lib/awspec/type/ec2_account_attributes.rb +7 -0
  440. data/lib/awspec/type/ecr_repository.rb +18 -0
  441. data/lib/awspec/type/ecs_cluster.rb +46 -0
  442. data/lib/awspec/type/ecs_container_instance.rb +30 -0
  443. data/lib/awspec/type/ecs_service.rb +29 -0
  444. data/lib/awspec/type/ecs_task_definition.rb +24 -0
  445. data/lib/awspec/type/efs.rb +22 -0
  446. data/lib/awspec/type/eip.rb +16 -0
  447. data/lib/awspec/type/eks.rb +24 -0
  448. data/lib/awspec/type/elasticache.rb +68 -0
  449. data/lib/awspec/type/elasticache_cache_parameter_group.rb +42 -0
  450. data/lib/awspec/type/elasticsearch.rb +23 -0
  451. data/lib/awspec/type/elastictranscoder_pipeline.rb +21 -0
  452. data/lib/awspec/type/elb.rb +94 -0
  453. data/lib/awspec/type/emr.rb +40 -0
  454. data/lib/awspec/type/firehose.rb +30 -0
  455. data/lib/awspec/type/iam_group.rb +48 -0
  456. data/lib/awspec/type/iam_policy.rb +60 -0
  457. data/lib/awspec/type/iam_role.rb +38 -0
  458. data/lib/awspec/type/iam_user.rb +38 -0
  459. data/lib/awspec/type/internet_gateway.rb +20 -0
  460. data/lib/awspec/type/kinesis.rb +73 -0
  461. data/lib/awspec/type/kms.rb +21 -0
  462. data/lib/awspec/type/lambda.rb +23 -0
  463. data/lib/awspec/type/lambda_account_settings.rb +7 -0
  464. data/lib/awspec/type/launch_configuration.rb +28 -0
  465. data/lib/awspec/type/launch_template.rb +34 -0
  466. data/lib/awspec/type/mq.rb +57 -0
  467. data/lib/awspec/type/nat_gateway.rb +29 -0
  468. data/lib/awspec/type/network_acl.rb +117 -0
  469. data/lib/awspec/type/network_interface.rb +56 -0
  470. data/lib/awspec/type/nlb.rb +35 -0
  471. data/lib/awspec/type/nlb_listener.rb +43 -0
  472. data/lib/awspec/type/nlb_target_group.rb +22 -0
  473. data/lib/awspec/type/rds.rb +109 -0
  474. data/lib/awspec/type/rds_account_attributes.rb +7 -0
  475. data/lib/awspec/type/rds_db_cluster_parameter_group.rb +21 -0
  476. data/lib/awspec/type/rds_db_parameter_group.rb +21 -0
  477. data/lib/awspec/type/redshift.rb +88 -0
  478. data/lib/awspec/type/redshift_cluster_parameter_group.rb +20 -0
  479. data/lib/awspec/type/resource_base.rb +24 -0
  480. data/lib/awspec/type/route53_hosted_zone.rb +65 -0
  481. data/lib/awspec/type/route_table.rb +84 -0
  482. data/lib/awspec/type/s3_bucket.rb +139 -0
  483. data/lib/awspec/type/secretsmanager.rb +14 -0
  484. data/lib/awspec/type/security_group.rb +148 -0
  485. data/lib/awspec/type/ses_identity.rb +70 -0
  486. data/lib/awspec/type/ses_send_quota.rb +7 -0
  487. data/lib/awspec/type/sns_topic.rb +50 -0
  488. data/lib/awspec/type/sqs.rb +37 -0
  489. data/lib/awspec/type/ssm_parameter.rb +26 -0
  490. data/lib/awspec/type/subnet.rb +39 -0
  491. data/lib/awspec/type/vpc.rb +66 -0
  492. data/lib/awspec/type/vpn_connection.rb +40 -0
  493. data/lib/awspec/type/vpn_gateway.rb +40 -0
  494. data/lib/awspec/type/waf_web_acl.rb +24 -0
  495. data/lib/awspec/type/wafregional_web_acl.rb +24 -0
  496. data/lib/awspec/version.rb +3 -0
  497. metadata +727 -0
@@ -0,0 +1,7 @@
1
+ ### exist
2
+
3
+ ```ruby
4
+ describe sqs('my-queue') do
5
+ it { should exist }
6
+ end
7
+ ```
@@ -0,0 +1,33 @@
1
+ ### exist
2
+
3
+ ```ruby
4
+ describe ssm_parameter('my-parameter') do
5
+ it { should exist }
6
+ end
7
+ ```
8
+
9
+ ### be_encrypted
10
+
11
+ ```ruby
12
+ describe ssm_parameter('my-parameter') do
13
+ it { should be_encrypted }
14
+ end
15
+ ```
16
+
17
+ ### have_tag
18
+
19
+ ```ruby
20
+ describe ssm_parameter('my-parameter') do
21
+ it { should have_tag('my-key').value('my-value') }
22
+ end
23
+ ```
24
+
25
+ ### advanced
26
+
27
+ ```ruby
28
+ describe ssm_parameter('my-parameter') do
29
+ its(:key_id) { should be_eql('6a81f446-27b0-4d51-a04f-af7ddeea2e22') }
30
+ its(:description) { should be_eql('Some string description') }
31
+ its(:version) { should be_eql(1) }
32
+ end
33
+ ```
@@ -0,0 +1,41 @@
1
+ ### exist
2
+
3
+ ```ruby
4
+ describe subnet('my-subnet') do
5
+ it { should exist }
6
+ end
7
+ ```
8
+
9
+ ### be_available, be_pending
10
+
11
+ ```ruby
12
+ describe subnet('my-subnet') do
13
+ it { should be_available }
14
+ end
15
+ ```
16
+
17
+ ### have_tag
18
+
19
+ ```ruby
20
+ describe subnet('my-subnet') do
21
+ it { should have_tag('Environment').value('QA') }
22
+ end
23
+ ```
24
+
25
+ ### advanced
26
+
27
+ `subnet` can use `Aws::EC2::Subnet` resource (see http://docs.aws.amazon.com/sdkforruby/api/Aws/EC2/Subnet.html).
28
+
29
+ ```ruby
30
+ describe subnet('my-subnet') do
31
+ its('vpc.id') { should eq 'vpc-ab123cde' }
32
+ end
33
+ ```
34
+
35
+ or
36
+
37
+ ```ruby
38
+ describe subnet('my-subnet') do
39
+ its('resource.vpc.id') { should eq 'vpc-ab123cde' }
40
+ end
41
+ ```
@@ -0,0 +1,88 @@
1
+ ### exist
2
+
3
+ ```ruby
4
+ describe vpc('my-vpc') do
5
+ it { should exist }
6
+ end
7
+ ```
8
+
9
+ ### be_available, be_pending
10
+
11
+ ```ruby
12
+ describe vpc('vpc-ab123cde') do
13
+ it { should be_available }
14
+ end
15
+ ```
16
+
17
+ ### be_connected_to_vpc
18
+
19
+ ```ruby
20
+ describe vpc('vpc-ab123cde') do
21
+ it { should be_connected_to_vpc('vpc-bcd1235e') }
22
+ it { should be_connected_to_vpc('vpc-bcd1235e').as_accepter }
23
+ it { should_not be_connected_to_vpc('vpc-bcd1235e').as_requester }
24
+ end
25
+ ```
26
+
27
+ ### have_network_acl
28
+
29
+ ```ruby
30
+ describe vpc('vpc-ab123cde') do
31
+ it { should have_network_acl('acl-1abc2d3e') }
32
+ it { should have_network_acl('my-network-acl') }
33
+ end
34
+ ```
35
+
36
+ ### have_route_table
37
+
38
+ ```ruby
39
+ describe vpc('vpc-ab123cde') do
40
+ it { should have_route_table('rtb-ab123cde') }
41
+ it { should have_route_table('my-route-table') }
42
+ end
43
+ ```
44
+
45
+ ### have_tag
46
+
47
+ ```ruby
48
+ describe vpc('vpc-ab123cde') do
49
+ it { should have_tag('Stack').value('Networking') }
50
+ end
51
+ ```
52
+
53
+ ### have_vpc_peering_connection
54
+
55
+ ```ruby
56
+ describe vpc('vpc-ab123cde') do
57
+ it { should have_vpc_peering_connection('pcx-c56789de') }
58
+ it { should have_vpc_peering_connection('pcx-c56789de').as_accepter }
59
+ it { should_not have_vpc_peering_connection('pcx-c56789de').as_requester }
60
+ end
61
+ ```
62
+
63
+ ### have_vpc_attribute
64
+
65
+ ```ruby
66
+ describe vpc('vpc-ab123cde') do
67
+ it { should have_vpc_attribute('enableDnsHostnames') }
68
+ it { should_not have_vpc_attribute('enableDnsSupport') }
69
+ end
70
+ ```
71
+
72
+ ### advanced
73
+
74
+ `vpc` can use `Aws::EC2::Vpc` resource (see http://docs.aws.amazon.com/sdkforruby/api/Aws/EC2/Vpc.html).
75
+
76
+ ```ruby
77
+ describe vpc('my-vpc') do
78
+ its('route_tables.first.route_table_id') { should eq 'rtb-a12bcd34' }
79
+ end
80
+ ```
81
+
82
+ or
83
+
84
+ ```ruby
85
+ describe vpc('my-vpc') do
86
+ its('resource.route_tables.first.route_table_id') { should eq 'rtb-a12bcd34' }
87
+ end
88
+ ```
@@ -0,0 +1,25 @@
1
+ ### exist
2
+
3
+ ```ruby
4
+ describe vpn_connection('my-vpn-connection') do
5
+ it { should exist }
6
+ end
7
+ ```
8
+
9
+ ### be_pending, be_available, be_deleting, be_deleted
10
+
11
+ ```ruby
12
+ describe vpn_connection('my-vpn-connection') do
13
+ it { should be_running }
14
+ end
15
+ ```
16
+
17
+ ### have_tag
18
+
19
+ ```ruby
20
+ describe vpn_connection('my-vpn-connection') do
21
+ it { should have_tag('Name').value('my-vpn-connection') }
22
+ end
23
+ ```
24
+
25
+ ### its(:vpn_connection_id), its(:state), its(:customer_gateway_configuration), its(:type), its(:customer_gateway_id), its(:vpn_gateway_id), its(:options)
@@ -0,0 +1,25 @@
1
+ ### exist
2
+
3
+ ```ruby
4
+ describe vpn_gateway('my-vpn-gateway') do
5
+ it { should exist }
6
+ end
7
+ ```
8
+
9
+ ### be_pending, be_available, be_deleting, be_deleted
10
+
11
+ ```ruby
12
+ describe vpn_gateway('my-vpn-gateway') do
13
+ it { should be_running }
14
+ end
15
+ ```
16
+
17
+ ### have_tag
18
+
19
+ ```ruby
20
+ describe vpn_gateway('my-vpn-gateway') do
21
+ it { should have_tag('Name').value('my-vpn-gateway') }
22
+ end
23
+ ```
24
+
25
+ ### its(:vpn_gateway_id), its(:state), its(:type), its(:availability_zone)
@@ -0,0 +1,29 @@
1
+ ### exist
2
+
3
+ ```ruby
4
+ describe waf_web_acl('my-waf-web-acl') do
5
+ it { should exist }
6
+ its(:default_action) { should eq 'BLOCK' }
7
+ it { should have_rule('my-waf-web-acl-allowed-ips') }
8
+ it { should have_rule('my-waf-web-acl-allowed-ips').order(2).action('BLOCK') }
9
+ end
10
+ ```
11
+
12
+ ### have_rule
13
+
14
+ ```ruby
15
+ describe waf_web_acl('my-waf-web-acl') do
16
+ it { should have_rule('my-waf-web-acl-allowed-ips') }
17
+ it { should have_rule('my-waf-web-acl-allowed-ips').order(2).action('BLOCK') }
18
+ end
19
+ ```
20
+
21
+ ### its(:default_action), its(:web_acl_id), its(:name), its(:metric_name)
22
+
23
+ ```ruby
24
+ describe waf_web_acl('my-waf-web-acl') do
25
+ its(:default_action) { should eq 'BLOCK' }
26
+ end
27
+ ```
28
+
29
+
@@ -0,0 +1,29 @@
1
+ ### exist
2
+
3
+ ```ruby
4
+ describe wafregional_web_acl('my-wafregional-web-acl') do
5
+ it { should exist }
6
+ its(:default_action) { should eq 'BLOCK' }
7
+ it { should have_rule('my-wafregional-web-acl-allowed-ips') }
8
+ it { should have_rule('my-wafregional-web-acl-allowed-ips').order(2).action('BLOCK') }
9
+ end
10
+ ```
11
+
12
+ ### have_rule
13
+
14
+ ```ruby
15
+ describe wafregional_web_acl('my-wafregional-web-acl') do
16
+ it { should have_rule('my-wafregional-web-acl-allowed-ips') }
17
+ it { should have_rule('my-wafregional-web-acl-allowed-ips').order(2).action('BLOCK') }
18
+ end
19
+ ```
20
+
21
+ ### its(:default_action), its(:web_acl_id), its(:name), its(:metric_name)
22
+
23
+ ```ruby
24
+ describe wafregional_web_acl('my-wafregional-web-acl') do
25
+ its(:default_action) { should eq 'BLOCK' }
26
+ end
27
+ ```
28
+
29
+
@@ -0,0 +1,45 @@
1
+ # Contributing
2
+
3
+ ## Add new resource type (ex. Redshift resource)
4
+
5
+ 1. Create your feature branch (`git checkout -b add-type-redshift`)
6
+ 2. Generate template files (`bundle exec bin/toolbox template redshift`)
7
+ 3. Fill files with code.
8
+ 4. `bundle update` to update gems.
9
+ 5. Generate [doc/resource_types.md](resource_types.md) (`bundle exec rake generate_docs`)
10
+ 6. Run test (`bundle exec rake spec`)
11
+ 7. Push to the branch (`git push origin add-type-redshift`)
12
+ 8. Create a new Pull Request
13
+
14
+ ### Troubleshooting
15
+
16
+ #### CI Failed 'Awspec::Generator::Doc::Type generate_doc output should be the same as doc/resource_types.md'
17
+
18
+ Maybe, your `aws-sdk-ruby` is not latest. Please exec `bundle update` and `bundle exec rake generate_docs`.
19
+
20
+ ( `aws-sdk-ruby` is often updated. )
21
+
22
+ ## Add new account attribute type (ex. CloudFormation::Client#describe_account_attributes )
23
+
24
+ 1. Create your feature branch (`git checkout -b add-type-cf-limit`)
25
+ 2. Generate template files (`bundle exec bin/toolbox template cloudformation_account_attributes -a`) **with -a option**
26
+ 3. Fill files with code.
27
+ 4. Generate [doc/resource_types.md](resource_types.md) (`bundle exec rake generate_docs`)
28
+ 5. Run test (`bundle exec rake spec`)
29
+ 6. Push to the branch (`git push origin add-type-cf-limit`)
30
+ 7. Create a new Pull Request
31
+
32
+ ## Append resource type document (ex. VPC resource `be_available`)
33
+
34
+ 1. Create vpc.md (`touch doc/_resource_types/vpc.md`)
35
+ 2. Write following document.
36
+
37
+ <pre>
38
+ ### be_available
39
+ (Write cool description)
40
+ ```ruby
41
+ describe vpc('my-vpc') do
42
+ it { should be_available }
43
+ end
44
+ ```
45
+ </pre>
@@ -0,0 +1,3852 @@
1
+ # Resource Types
2
+
3
+ [acm](#acm)
4
+ | [alb](#alb)
5
+ | [alb_listener](#alb_listener)
6
+ | [alb_target_group](#alb_target_group)
7
+ | [ami](#ami)
8
+ | [apigateway](#apigateway)
9
+ | [autoscaling_group](#autoscaling_group)
10
+ | [batch_compute_environment](#batch_compute_environment)
11
+ | [batch_job_definition](#batch_job_definition)
12
+ | [batch_job_queue](#batch_job_queue)
13
+ | [cloudformation_stack](#cloudformation_stack)
14
+ | [cloudfront_distribution](#cloudfront_distribution)
15
+ | [cloudtrail](#cloudtrail)
16
+ | [cloudwatch_alarm](#cloudwatch_alarm)
17
+ | [cloudwatch_event](#cloudwatch_event)
18
+ | [cloudwatch_logs](#cloudwatch_logs)
19
+ | [codebuild](#codebuild)
20
+ | [codedeploy](#codedeploy)
21
+ | [codedeploy_deployment_group](#codedeploy_deployment_group)
22
+ | [customer_gateway](#customer_gateway)
23
+ | [directconnect_virtual_interface](#directconnect_virtual_interface)
24
+ | [dynamodb_table](#dynamodb_table)
25
+ | [ebs](#ebs)
26
+ | [ec2](#ec2)
27
+ | [ecr_repository](#ecr_repository)
28
+ | [ecs_cluster](#ecs_cluster)
29
+ | [ecs_container_instance](#ecs_container_instance)
30
+ | [ecs_service](#ecs_service)
31
+ | [ecs_task_definition](#ecs_task_definition)
32
+ | [efs](#efs)
33
+ | [eip](#eip)
34
+ | [eks](#eks)
35
+ | [elasticache](#elasticache)
36
+ | [elasticache_cache_parameter_group](#elasticache_cache_parameter_group)
37
+ | [elasticsearch](#elasticsearch)
38
+ | [elastictranscoder_pipeline](#elastictranscoder_pipeline)
39
+ | [elb](#elb)
40
+ | [emr](#emr)
41
+ | [firehose](#firehose)
42
+ | [iam_group](#iam_group)
43
+ | [iam_policy](#iam_policy)
44
+ | [iam_role](#iam_role)
45
+ | [iam_user](#iam_user)
46
+ | [internet_gateway](#internet_gateway)
47
+ | [kinesis](#kinesis)
48
+ | [kms](#kms)
49
+ | [lambda](#lambda)
50
+ | [launch_configuration](#launch_configuration)
51
+ | [launch_template](#launch_template)
52
+ | [mq](#mq)
53
+ | [nat_gateway](#nat_gateway)
54
+ | [network_acl](#network_acl)
55
+ | [network_interface](#network_interface)
56
+ | [nlb](#nlb)
57
+ | [nlb_listener](#nlb_listener)
58
+ | [nlb_target_group](#nlb_target_group)
59
+ | [rds](#rds)
60
+ | [rds_db_cluster_parameter_group](#rds_db_cluster_parameter_group)
61
+ | [rds_db_parameter_group](#rds_db_parameter_group)
62
+ | [redshift](#redshift)
63
+ | [redshift_cluster_parameter_group](#redshift_cluster_parameter_group)
64
+ | [route53_hosted_zone](#route53_hosted_zone)
65
+ | [route_table](#route_table)
66
+ | [s3_bucket](#s3_bucket)
67
+ | [secretsmanager](#secretsmanager)
68
+ | [security_group](#security_group)
69
+ | [ses_identity](#ses_identity)
70
+ | [sns_topic](#sns_topic)
71
+ | [sqs](#sqs)
72
+ | [ssm_parameter](#ssm_parameter)
73
+ | [subnet](#subnet)
74
+ | [vpc](#vpc)
75
+ | [vpn_connection](#vpn_connection)
76
+ | [vpn_gateway](#vpn_gateway)
77
+ | [waf_web_acl](#waf_web_acl)
78
+ | [wafregional_web_acl](#wafregional_web_acl)
79
+ | [account](#account)
80
+
81
+ ## <a name="acm">acm</a>
82
+
83
+ Acm resource type.
84
+
85
+ ### exist
86
+
87
+ ```ruby
88
+ describe acm('example.com') do
89
+ it { should exist }
90
+ end
91
+ ```
92
+
93
+
94
+ ### be_pending_validation, be_issued, be_inactive, be_expired, be_validation_timed_out, be_revoked, be_failed
95
+
96
+ ### have_domain_name
97
+
98
+ ### have_domain_validation_option
99
+
100
+ ```ruby
101
+ describe acm('example.com') do
102
+ it { should have_domain_validation_option(domain_name: 'example.com', validation_method: 'DNS', validation_status: 'SUCCESS') }
103
+ it { should have_domain_validation_option(domain_name: 'mail.example.com', validation_method: 'EMAIL') }
104
+ end
105
+ ```
106
+
107
+ ### its(:certificate_arn), its(:domain_name), its(:subject_alternative_names), its(:serial), its(:subject), its(:issuer), its(:created_at), its(:issued_at), its(:imported_at), its(:status), its(:revoked_at), its(:revocation_reason), its(:not_before), its(:not_after), its(:key_algorithm), its(:signature_algorithm), its(:in_use_by), its(:failure_reason), its(:type), its(:renewal_summary), its(:key_usages), its(:extended_key_usages), its(:certificate_authority_arn), its(:renewal_eligibility), its(:options)
108
+ ## <a name="alb">alb</a>
109
+
110
+ ALB resource type.
111
+
112
+ ### exist
113
+
114
+ ```ruby
115
+ describe alb('my-alb') do
116
+ it { should exist }
117
+ end
118
+ ```
119
+
120
+
121
+ ### be_active, be_provisioning, be_failed
122
+
123
+ ```ruby
124
+ describe alb('my-alb') do
125
+ it { should be_active }
126
+ end
127
+ ```
128
+
129
+
130
+ ### have_security_group
131
+
132
+ ```ruby
133
+ describe alb('my-alb') do
134
+ it { should have_security_group('sg-1a2b3cd4') }
135
+ end
136
+ ```
137
+
138
+
139
+ ### have_subnet
140
+
141
+ ```ruby
142
+ describe alb('my-alb') do
143
+ it { should have_subnet('subnet-1234a567') }
144
+ end
145
+ ```
146
+
147
+
148
+ ### have_tag
149
+
150
+ ```ruby
151
+ describe alb('my-alb') do
152
+ it { should have_tag('environment').value('dev') }
153
+ end
154
+ ```
155
+
156
+
157
+ ### belong_to_vpc
158
+
159
+ ```ruby
160
+ describe alb('my-alb') do
161
+ it { should belong_to_vpc('my-vpc') }
162
+ end
163
+ ```
164
+
165
+ ### its(:load_balancer_arn), its(:dns_name), its(:canonical_hosted_zone_id), its(:created_time), its(:load_balancer_name), its(:scheme), its(:vpc_id), its(:type), its(:security_groups), its(:ip_address_type)
166
+ ## <a name="alb_listener">alb_listener</a>
167
+
168
+ AlbListener resource type.
169
+
170
+ ### exist
171
+
172
+ ```ruby
173
+ describe alb_listener('arn:aws:elasticloadbalancing:ap-northeast-1:1234567890:listener/app/my-alb/1aa1bb1cc1ddee11/f2f7dc8efc522ab2') do
174
+ it { should exist }
175
+ its(:port) { should eq 80 }
176
+ its(:protocol) { should eq 'HTTP' }
177
+ end
178
+ ```
179
+
180
+
181
+ ### have_rule
182
+
183
+ ```ruby
184
+ describe alb_listener('arn:aws:elasticloadbalancing:ap-northeast-1:1234567890:listener/app/my-alb/1aa1bb1cc1ddee11/f2f7dc8efc522ab2') do
185
+ it { should have_rule('arn:aws:elasticloadbalancing:ap-northeast-1:1234567890:listener-rule/app/my-alb/1aa1bb1cc1ddee11/f2f7dc8efc522ab2/9683b2d02a6cabee') }
186
+ it do
187
+ should have_rule.priority('10')
188
+ .conditions(field: 'path-pattern', values: ['/img/*'])
189
+ .actions(target_group_arn: 'arn:aws:elasticloadbalancing:ap-northeast-1:1234567890:123456789012:targetgroup/73e2d6bc24d8a067/73e2d6bc24d8a067', type: 'forward')
190
+ end
191
+ it do
192
+ should have_rule.priority('10')
193
+ .if(field: 'path-pattern', values: ['/img/*'])
194
+ .then(target_group_arn: 'arn:aws:elasticloadbalancing:ap-northeast-1:1234567890:123456789012:targetgroup/73e2d6bc24d8a067/73e2d6bc24d8a067', type: 'forward')
195
+ end
196
+ it { should have_rule.conditions([{ field: 'path-pattern', values: ['/admin/*'] }, { field: 'host-header', values: ['admin.example.com'] }]) }
197
+ it { should have_rule.actions(target_group_name: 'my-alb-target-group', type: 'forward') }
198
+ end
199
+ ```
200
+
201
+ ### its(:listener_arn), its(:load_balancer_arn), its(:port), its(:protocol), its(:certificates), its(:ssl_policy)
202
+ ## <a name="alb_target_group">alb_target_group</a>
203
+
204
+ AlbTargetGroup resource type.
205
+
206
+ ### exist
207
+
208
+ ```ruby
209
+ describe alb_target_group('my-alb-target-group') do
210
+ it { should exist }
211
+ its(:health_check_path) { should eq '/' }
212
+ its(:health_check_port) { should eq 'traffic-port' }
213
+ its(:health_check_protocol) { should eq 'HTTP' }
214
+ end
215
+ ```
216
+
217
+
218
+ ### have_ec2
219
+
220
+ ```ruby
221
+ describe alb_target_group('my-alb-target-group') do
222
+ it { should have_ec2('my-ec2') }
223
+ end
224
+ ```
225
+
226
+
227
+ ### belong_to_alb
228
+
229
+ ```ruby
230
+ describe alb_target_group('my-alb-target-group') do
231
+ it { should belong_to_alb('my-alb') }
232
+ end
233
+ ```
234
+
235
+
236
+ ### belong_to_vpc
237
+
238
+ ```ruby
239
+ describe alb_target_group('my-alb-target-group') do
240
+ it { should belong_to_vpc('my-vpc') }
241
+ end
242
+ ```
243
+
244
+
245
+ ### its(:target_group_arn), its(:target_group_name), its(:protocol), its(:port), its(:vpc_id), its(:health_check_protocol), its(:health_check_port), its(:health_check_enabled), its(:health_check_interval_seconds), its(:health_check_timeout_seconds), its(:healthy_threshold_count), its(:unhealthy_threshold_count), its(:health_check_path), its(:load_balancer_arns), its(:target_type)
246
+ ## <a name="ami">ami</a>
247
+
248
+ AMI resource type.
249
+
250
+ ### exist
251
+
252
+ ```ruby
253
+ describe ami('my-ami') do
254
+ it { should exist }
255
+ end
256
+ ```
257
+
258
+
259
+ ### be_pending, be_available, be_invalid, be_deregistered, be_transient, be_failed, be_error
260
+
261
+ ```ruby
262
+ describe ami('my-ami') do
263
+ it { should be_available }
264
+ end
265
+ ```
266
+
267
+
268
+ ### have_tag
269
+
270
+ ### its(:architecture), its(:creation_date), its(:image_id), its(:image_location), its(:image_type), its(:public), its(:kernel_id), its(:owner_id), its(:platform), its(:ramdisk_id), its(:state), its(:description), its(:ena_support), its(:hypervisor), its(:image_owner_alias), its(:name), its(:root_device_name), its(:root_device_type), its(:sriov_net_support), its(:state_reason), its(:virtualization_type)
271
+ ### :unlock: Advanced use
272
+
273
+ `ami` can use `Aws::EC2::Image` resource (see http://docs.aws.amazon.com/sdkforruby/api/Aws/EC2/Image.html).
274
+
275
+ ## <a name="apigateway">apigateway</a>
276
+
277
+ Apigateway resource type.
278
+
279
+ ### exist
280
+
281
+ ```ruby
282
+ describe apigateway('my-apigateway') do
283
+ it { should exist }
284
+ end
285
+ ```
286
+
287
+ ### its(:id), its(:name), its(:description), its(:created_date), its(:version), its(:warnings), its(:binary_media_types), its(:minimum_compression_size), its(:api_key_source), its(:policy), its(:tags)
288
+ ## <a name="autoscaling_group">autoscaling_group</a>
289
+
290
+ AutoscalingGroup resource type.
291
+
292
+ ### exist
293
+
294
+ ```ruby
295
+ describe autoscaling_group('my-auto-scaling-group') do
296
+ it { should exist }
297
+ end
298
+ ```
299
+
300
+
301
+ ### have_alb_target_group
302
+
303
+ ```ruby
304
+ describe autoscaling_group('my-auto-scaling-group') do
305
+ it { should have_alb_target_group('my-alb-target-group') }
306
+ end
307
+ ```
308
+
309
+
310
+ ### have_ec2
311
+
312
+ ```ruby
313
+ describe autoscaling_group('my-auto-scaling-group') do
314
+ it { should have_ec2('my-ec2') }
315
+ end
316
+ ```
317
+
318
+
319
+ ### have_elb
320
+
321
+ ```ruby
322
+ describe autoscaling_group('my-auto-scaling-group') do
323
+ it { should have_elb('my-elb') }
324
+ end
325
+ ```
326
+
327
+
328
+ ### have_launch_configuration
329
+
330
+ ```ruby
331
+ describe autoscaling_group('my-auto-scaling-group') do
332
+ it { should have_launch_configuration('my-lc') }
333
+ end
334
+ ```
335
+
336
+
337
+ ### have_nlb_target_group
338
+
339
+ ### have_suspended_process
340
+
341
+ ### have_tag
342
+
343
+ ```ruby
344
+ describe autoscaling_group('my-auto-scaling-group') do
345
+ it { should have_tag('Name').value('my-group') }
346
+ end
347
+ ```
348
+
349
+ ### its(:auto_scaling_group_name), its(:auto_scaling_group_arn), its(:launch_configuration_name), its(:launch_template), its(:mixed_instances_policy), its(:min_size), its(:max_size), its(:desired_capacity), its(:default_cooldown), its(:availability_zones), its(:load_balancer_names), its(:target_group_arns), its(:health_check_type), its(:health_check_grace_period), its(:created_time), its(:placement_group), its(:vpc_zone_identifier), its(:enabled_metrics), its(:status), its(:termination_policies), its(:new_instances_protected_from_scale_in), its(:service_linked_role_arn), its(:max_instance_lifetime)
350
+ ## <a name="batch_compute_environment">batch_compute_environment</a>
351
+
352
+ BatchComputeEnvironment resource type.
353
+
354
+ ### exist
355
+
356
+ ```ruby
357
+ describe batch_compute_environment('my-batch-compute-environment') do
358
+ it { should exist }
359
+ end
360
+ ```
361
+
362
+
363
+ ### be_disabled
364
+
365
+ ### be_enabled
366
+
367
+ ### be_enabled, be_disabled
368
+
369
+ ```ruby
370
+ describe batch_compute_environment('my-batch-compute-environment') do
371
+ it { should be_enabled }
372
+ end
373
+ ```
374
+
375
+
376
+ ### be_managed
377
+
378
+ ### be_managed, be_unmanaged
379
+
380
+ ```ruby
381
+ describe batch_compute_environment('my-batch-compute-environment') do
382
+ it { should be_managed }
383
+ end
384
+ ```
385
+
386
+ ### be_unmanaged
387
+
388
+ ### its(:compute_environment_name), its(:compute_environment_arn), its(:ecs_cluster_arn), its(:type), its(:state), its(:status), its(:status_reason), its(:service_role)
389
+ ## <a name="batch_job_definition">batch_job_definition</a>
390
+
391
+ BatchJobDefinition resource type.
392
+
393
+ ### exist
394
+
395
+ ```ruby
396
+ describe batch_job_definition('my-batch-job-definition') do
397
+ it { should exist }
398
+ end
399
+ ```
400
+
401
+ ### its(:job_definition_name), its(:job_definition_arn), its(:revision), its(:status), its(:type), its(:parameters), its(:retry_strategy), its(:timeout), its(:node_properties)
402
+ ## <a name="batch_job_queue">batch_job_queue</a>
403
+
404
+ BatchJobQueue resource type.
405
+
406
+ ### exist
407
+
408
+ ```ruby
409
+ describe batch_job_queue('my-batch-job-queue') do
410
+ it { should exist }
411
+ end
412
+ ```
413
+
414
+
415
+ ### be_disabled
416
+
417
+ ### be_enabled
418
+
419
+ ### have_compute_environment_order
420
+
421
+ ```ruby
422
+ describe batch_job_queue('my-batch-job-queue') do
423
+ it { should have_compute_environment_order('arn:aws:batch:us-east-1:012345678910:compute-environment/C4OnDemand', 1) }
424
+ end
425
+ ```
426
+
427
+ ### its(:job_queue_name), its(:job_queue_arn), its(:state), its(:status), its(:status_reason), its(:priority)
428
+ ## <a name="cloudformation_stack">cloudformation_stack</a>
429
+
430
+ CloudformationStack resource type.
431
+
432
+ ### exist
433
+
434
+ ```ruby
435
+ describe cloudformation_stack('my-cloudformation-stack') do
436
+ it { should exist }
437
+ its(:stack_status) { should eq 'UPDATE_COMPLETE' }
438
+ end
439
+ ```
440
+
441
+ ### its(:stack_id), its(:stack_name), its(:change_set_id), its(:description), its(:parameters), its(:creation_time), its(:deletion_time), its(:last_updated_time), its(:rollback_configuration), its(:stack_status), its(:stack_status_reason), its(:disable_rollback), its(:notification_arns), its(:timeout_in_minutes), its(:capabilities), its(:role_arn), its(:enable_termination_protection), its(:parent_id), its(:root_id), its(:drift_information)
442
+ ## <a name="cloudfront_distribution">cloudfront_distribution</a>
443
+
444
+ CloudfrontDistribution resource type.
445
+
446
+ ### exist
447
+
448
+ ```ruby
449
+ describe cloudfront_distribution('123456789zyxw.cloudfront.net') do
450
+ it { should exist }
451
+ end
452
+ ```
453
+
454
+
455
+ ### be_in_progress, be_deployed
456
+
457
+ ```ruby
458
+ describe cloudfront_distribution('123456789zyxw.cloudfront.net') do
459
+ it { should be_deployed }
460
+ end
461
+ ```
462
+
463
+
464
+ ### have_custom_response_error_code
465
+
466
+ ```ruby
467
+ describe cloudfront_distribution('123456789zyxw.cloudfront.net') do
468
+ it do
469
+ should have_custom_response_error_code(400)
470
+ .error_caching_min_ttl(60)
471
+ .response_page_path('/path/to/400.html')
472
+ .response_code(400)
473
+ end
474
+ it do
475
+ should have_custom_response_error_code(403)
476
+ .error_caching_min_ttl(60)
477
+ .response_page_path('/path/to/403.html')
478
+ .response_code('403')
479
+ end
480
+ it do
481
+ should have_custom_response_error_code(500)
482
+ .error_caching_min_ttl(60)
483
+ end
484
+ end
485
+ ```
486
+
487
+
488
+ ### have_origin
489
+
490
+ ```ruby
491
+ describe cloudfront_distribution('E2CLOUDFRONTXX') do
492
+ it do
493
+ should have_origin('cf-s3-origin-hosting.dev.example.com')
494
+ .domain_name('cf-s3-origin-hosting.dev.example.com.s3.amazonaws.com')
495
+ .origin_path('/img')
496
+ .origin_access_identity('origin-access-identity/cloudfront/E2VVVVVVVVVVVV')
497
+ end
498
+ end
499
+ ```
500
+
501
+
502
+ ### have_origin_domain_name
503
+
504
+ ```ruby
505
+ describe cloudfront_distribution('123456789zyxw.cloudfront.net') do
506
+ it { should have_origin_domain_name('cf-s3-origin-hosting.dev.example.com.s3.amazonaws.com') }
507
+ end
508
+ ```
509
+
510
+
511
+ ### have_origin_domain_name_and_path
512
+
513
+ ```ruby
514
+ describe cloudfront_distribution('123456789zyxw.cloudfront.net') do
515
+ it { should have_origin_domain_name_and_path('cf-s3-origin-hosting.dev.example.com.s3.amazonaws.com/img') }
516
+ end
517
+ ```
518
+
519
+ ### its(:id), its(:arn), its(:status), its(:last_modified_time), its(:domain_name), its(:origin_groups), its(:comment), its(:price_class), its(:enabled), its(:web_acl_id), its(:http_version), its(:is_ipv6_enabled), its(:alias_icp_recordals)
520
+ ## <a name="cloudtrail">cloudtrail</a>
521
+
522
+ Cloudtrail resource type.
523
+
524
+ ### exist
525
+
526
+ ```ruby
527
+ describe cloudtrail('my-trail') do
528
+ it { should exist }
529
+ end
530
+ ```
531
+
532
+
533
+ ### be_logging
534
+
535
+ ```ruby
536
+ describe cloudtrail('my-trail') do
537
+ it { should be_logging }
538
+ end
539
+ ```
540
+
541
+
542
+ ### be_multi_region_trail
543
+
544
+ ```ruby
545
+ describe cloudtrail('my-trail') do
546
+ it { should be_multi_region_trail }
547
+ end
548
+ ```
549
+
550
+
551
+ ### have_global_service_events_included
552
+
553
+ ```ruby
554
+ describe cloudtrail('my-trail') do
555
+ it { should have_global_service_events_included }
556
+ end
557
+ ```
558
+
559
+
560
+ ### have_log_file_validation_enabled
561
+
562
+ ```ruby
563
+ describe cloudtrail('my-trail') do
564
+ it { should have_log_file_validation_enabled }
565
+ end
566
+ ```
567
+
568
+
569
+ ### have_tag
570
+
571
+ ```ruby
572
+ describe cloudtrail('my-trail') do
573
+ it { should have_tag('Name').value('my-trail') }
574
+ end
575
+ ```
576
+
577
+ ### its(:name), its(:s3_bucket_name), its(:s3_key_prefix), its(:sns_topic_name), its(:sns_topic_arn), its(:include_global_service_events), its(:is_multi_region_trail), its(:home_region), its(:trail_arn), its(:log_file_validation_enabled), its(:cloud_watch_logs_log_group_arn), its(:cloud_watch_logs_role_arn), its(:kms_key_id), its(:has_custom_event_selectors), its(:has_insight_selectors), its(:is_organization_trail)
578
+ ## <a name="cloudwatch_alarm">cloudwatch_alarm</a>
579
+
580
+ CloudwatchAlarm resource type.
581
+
582
+ ### exist
583
+
584
+ ```ruby
585
+ describe cloudwatch_alarm('my-cloudwatch-alarm') do
586
+ it { should exist }
587
+ end
588
+ ```
589
+
590
+
591
+ ### have_alarm_action
592
+
593
+ ```ruby
594
+ describe cloudwatch_alarm('my-cloudwatch-alarm') do
595
+ it { should have_alarm_action('arn:aws:sns:ap-northeast-1:1234567890:sns_alert') }
596
+ end
597
+ ```
598
+
599
+
600
+ ### have_insufficient_data_action
601
+
602
+ ```ruby
603
+ describe cloudwatch_alarm('my-cloudwatch-alarm') do
604
+ it { should have_insufficient_data_action('arn:aws:sns:ap-northeast-1:1234567890:sns_alert') }
605
+ end
606
+ ```
607
+
608
+
609
+ ### have_ok_action
610
+
611
+ ```ruby
612
+ describe cloudwatch_alarm('my-cloudwatch-alarm') do
613
+ it { should have_ok_action('arn:aws:sns:ap-northeast-1:1234567890:sns_alert') }
614
+ end
615
+ ```
616
+
617
+
618
+ ### belong_to_metric
619
+
620
+ ```ruby
621
+ describe cloudwatch_alarm('my-cloudwatch-alarm') do
622
+ it { should belong_to_metric('NumberOfProcesses').namespace('my-cloudwatch-namespace') }
623
+ end
624
+ ```
625
+
626
+ ### its(:alarm_name), its(:alarm_arn), its(:alarm_description), its(:alarm_configuration_updated_timestamp), its(:actions_enabled), its(:ok_actions), its(:alarm_actions), its(:insufficient_data_actions), its(:state_value), its(:state_reason), its(:state_reason_data), its(:state_updated_timestamp), its(:metric_name), its(:namespace), its(:statistic), its(:extended_statistic), its(:period), its(:unit), its(:evaluation_periods), its(:datapoints_to_alarm), its(:threshold), its(:comparison_operator), its(:treat_missing_data), its(:evaluate_low_sample_count_percentile), its(:metrics), its(:threshold_metric_id)
627
+ ## <a name="cloudwatch_event">cloudwatch_event</a>
628
+
629
+ CloudwatchEvent resource type.
630
+
631
+ ### exist
632
+
633
+ ### be_enable
634
+
635
+ ### be_scheduled
636
+
637
+ ### its(:name), its(:arn), its(:event_pattern), its(:state), its(:description), its(:schedule_expression), its(:role_arn), its(:managed_by), its(:event_bus_name)
638
+ ## <a name="cloudwatch_logs">cloudwatch_logs</a>
639
+
640
+ CloudwatchLogs resource type.
641
+
642
+ ### exist
643
+
644
+ ```ruby
645
+ describe cloudwatch_logs('my-cloudwatch-logs-group') do
646
+ it { should exist }
647
+ end
648
+ ```
649
+
650
+
651
+ ### have_log_stream
652
+
653
+ ```ruby
654
+ describe cloudwatch_logs('my-cloudwatch-logs-group') do
655
+ it { should have_log_stream('my-cloudwatch-logs-stream') }
656
+ end
657
+ ```
658
+
659
+
660
+ ### have_metric_filter
661
+
662
+ ```ruby
663
+ describe cloudwatch_logs('my-cloudwatch-logs-group') do
664
+ it { should have_metric_filter('my-cloudwatch-logs-metric-filter') }
665
+ end
666
+ ```
667
+
668
+
669
+ ### have_subscription_filter
670
+
671
+ ```ruby
672
+ describe cloudwatch_logs('my-cloudwatch-logs-group') do
673
+ it { should have_subscription_filter('my-cloudwatch-logs-subscription-filter') }
674
+ end
675
+ ```
676
+ or
677
+ ```ruby
678
+ describe cloudwatch_logs('my-cloudwatch-logs-group') do
679
+ it do
680
+ should have_subscription_filter('my-cloudwatch-logs-subscription-filter')\
681
+ .filter_pattern('[host, ident, authuser, date, request, status, bytes]')
682
+ end
683
+ end
684
+ ```
685
+
686
+
687
+ ### have_tag
688
+
689
+ ```ruby
690
+ describe cloudwatch_logs('my-cloudwatch-logs-group') do
691
+ it { should have_tag('Name').value('my-cloudwatch-logs-group') }
692
+ end
693
+ ```
694
+
695
+ ### its(:log_group_name), its(:creation_time), its(:retention_in_days), its(:metric_filter_count), its(:arn), its(:stored_bytes), its(:kms_key_id)
696
+ ## <a name="codebuild">codebuild</a>
697
+
698
+ Codebuild resource type.
699
+
700
+ ### exist
701
+
702
+
703
+ ## <a name="codedeploy">codedeploy</a>
704
+
705
+ Codedeploy resource type.
706
+
707
+ ### exist
708
+
709
+ ### its(:application_id), its(:application_name), its(:create_time), its(:linked_to_git_hub), its(:git_hub_account_name), its(:compute_platform)
710
+ ## <a name="codedeploy_deployment_group">codedeploy_deployment_group</a>
711
+
712
+ CodedeployDeploymentGroup resource type.
713
+
714
+ ### exist
715
+
716
+ You can set the `application_name` (default: `default`).
717
+
718
+ ```ruby
719
+ describe codedeploy_deployment_group('my-codedeploy-deployment-group'), application_name: 'my-codedeploy-application' do
720
+ it { should exist }
721
+ end
722
+ ```
723
+
724
+
725
+ ### have_autoscaling_group
726
+
727
+ ```ruby
728
+ describe codedeploy_deployment_group('my-codedeploy-deployment-group'), application_name: 'my-codedeploy-application' do
729
+ it { should have_autoscaling_group('my-autoscaling-group') }
730
+ end
731
+ ```
732
+
733
+ ### its(:application_name), its(:deployment_group_id), its(:deployment_group_name), its(:deployment_config_name), its(:on_premises_instance_tag_filters), its(:service_role_arn), its(:target_revision), its(:trigger_configurations), its(:alarm_configuration), its(:deployment_style), its(:load_balancer_info), its(:last_successful_deployment), its(:last_attempted_deployment), its(:ec2_tag_set), its(:on_premises_tag_set), its(:compute_platform), its(:ecs_services)
734
+ ## <a name="customer_gateway">customer_gateway</a>
735
+
736
+ CustomerGateway resource type.
737
+
738
+ ### exist
739
+
740
+ ```ruby
741
+ describe customer_gateway('my-customer-gateway') do
742
+ it { should exist }
743
+ end
744
+ ```
745
+
746
+
747
+ ### be_pending, be_available, be_deleting, be_deleted
748
+
749
+ ```ruby
750
+ describe customer_gateway('my-customer-gateway') do
751
+ it { should be_running }
752
+ end
753
+ ```
754
+
755
+
756
+ ### have_tag
757
+
758
+ ```ruby
759
+ describe customer_gateway('my-customer-gateway') do
760
+ it { should have_tag('Name').value('my-customer-gateway') }
761
+ end
762
+ ```
763
+
764
+
765
+ ### its(:bgp_asn), its(:customer_gateway_id), its(:ip_address), its(:certificate_arn), its(:state), its(:type), its(:device_name), its(:tags)
766
+ ## <a name="directconnect_virtual_interface">directconnect_virtual_interface</a>
767
+
768
+ DirectconnectVirtualInterface resource type.
769
+
770
+ ```ruby
771
+ describe directconnect_virtual_interface('my-directconnect-virtual-interface') do
772
+ it { should exist }
773
+ it { should be_available }
774
+ its(:connection_id) { should eq 'dxcon-abcd5fgh' }
775
+ its(:virtual_interface_id) { should eq 'dxvif-aabbccdd' }
776
+ its(:amazon_address) { should eq '170.252.252.1/30' }
777
+ its(:customer_address) { should eq '123.456.789.2/30' }
778
+ its(:virtual_gateway_id) { should eq 'vgw-d234e5f6' }
779
+ end
780
+ ```
781
+
782
+
783
+ ### exist
784
+
785
+ ```ruby
786
+ describe directconnect_virtual_interface('my-directconnect-virtual-interface') do
787
+ it { should exist }
788
+ end
789
+ ```
790
+
791
+
792
+ ### be_confirming, be_verifying, be_pending, be_available, be_deleting, be_deleted, be_rejected
793
+
794
+ ```ruby
795
+ describe directconnect_virtual_interface('my-directconnect-virtual-interface') do
796
+ it { should exist }
797
+ it { should be_available }
798
+ end
799
+ ```
800
+
801
+ ### its(:owner_account), its(:virtual_interface_id), its(:location), its(:connection_id), its(:virtual_interface_type), its(:virtual_interface_name), its(:vlan), its(:asn), its(:amazon_side_asn), its(:auth_key), its(:amazon_address), its(:customer_address), its(:address_family), its(:virtual_interface_state), its(:customer_router_config), its(:mtu), its(:jumbo_frame_capable), its(:virtual_gateway_id), its(:direct_connect_gateway_id), its(:route_filter_prefixes), its(:bgp_peers), its(:region), its(:aws_device_v2), its(:tags)
802
+ ## <a name="dynamodb_table">dynamodb_table</a>
803
+
804
+ DynamodbTable resource type.
805
+
806
+ ### exist
807
+
808
+ ```ruby
809
+ describe dynamodb_table('my-dynamodb-table') do
810
+ it { should exist }
811
+ end
812
+ ```
813
+
814
+
815
+ ### be_creating, be_updating, be_deleting, be_active
816
+
817
+ ### have_attribute_definition
818
+
819
+ ```ruby
820
+ describe dynamodb_table('my-dynamodb-table') do
821
+ it { should have_attribute_definition('my-dynamodb-table-attaribute1').attribute_type('S') }
822
+ it { should have_attribute_definition('my-dynamodb-table-attaribute2').attribute_type('N') }
823
+ end
824
+ ```
825
+
826
+
827
+ ### have_key_schema
828
+
829
+ ```ruby
830
+ describe dynamodb_table('my-dynamodb-table') do
831
+ it { should have_key_schema('my-dynamodb-table-key_schema1').key_type('HASH') }
832
+ it { should have_key_schema('my-dynamodb-table-key_schema2').key_type('RANGE') }
833
+ end
834
+ ```
835
+
836
+
837
+ ### its(:table_name), its(:table_status), its(:creation_date_time), its(:table_size_bytes), its(:item_count), its(:table_arn), its(:table_id), its(:billing_mode_summary), its(:local_secondary_indexes), its(:global_secondary_indexes), its(:stream_specification), its(:latest_stream_label), its(:latest_stream_arn), its(:global_table_version), its(:replicas), its(:restore_summary), its(:sse_description), its(:archival_summary)
838
+ ### :unlock: Advanced use
839
+
840
+ `dynamodb_table` can use `Aws::DynamoDB::Table` resource (see http://docs.aws.amazon.com/sdkforruby/api/Aws/DynamoDB/Table.html).
841
+
842
+ ```ruby
843
+ describe dynamodb_table('my-dynamodb-table') do
844
+ its('key_schema.first.key_type') { should eq 'HASH' }
845
+ end
846
+ ```
847
+
848
+ or
849
+
850
+ ```ruby
851
+ describe dynamodb_table('my-dynamodb-table') do
852
+ its('resource.key_schema.first.key_type') { should eq 'HASH' }
853
+ end
854
+ ```
855
+
856
+
857
+ ## <a name="ebs">ebs</a>
858
+
859
+ EBS resource type.
860
+
861
+ ### exist
862
+
863
+ ```ruby
864
+ describe ebs('my-volume') do
865
+ it { should exist }
866
+ end
867
+ ```
868
+
869
+
870
+ ### be_attached_to
871
+
872
+ ```ruby
873
+ describe ebs('my-volume') do
874
+ it { should be_attached_to('my-ec2') }
875
+ end
876
+ ```
877
+
878
+
879
+ ### be_creating, be_available, be_in_use, be_deleting, be_deleted, be_error
880
+
881
+ ```ruby
882
+ describe ebs('my-volume') do
883
+ it { should be_in_use }
884
+ end
885
+ ```
886
+
887
+
888
+ ### have_tag
889
+
890
+ ```ruby
891
+ describe ebs('my-volume') do
892
+ it { should have_tag('Name').value('my-volume') }
893
+ end
894
+ ```
895
+
896
+
897
+ ### its(:availability_zone), its(:create_time), its(:encrypted), its(:kms_key_id), its(:outpost_arn), its(:size), its(:snapshot_id), its(:state), its(:volume_id), its(:iops), its(:volume_type), its(:fast_restored)
898
+ ### :unlock: Advanced use
899
+
900
+ `ebs` can use `Aws::EC2::Volume` resource (see http://docs.aws.amazon.com/sdkforruby/api/Aws/EC2/Volume.html).
901
+
902
+ ```ruby
903
+ describe ebs('my-volume') do
904
+ its('attachments.first.instance_id') { should eq 'i-ec12345a' }
905
+ end
906
+ ```
907
+
908
+ or
909
+
910
+ ```ruby
911
+ describe ebs('my-volume') do
912
+ its('resource.attachments.first.instance_id') { should eq 'i-ec12345a' }
913
+ end
914
+ ```
915
+
916
+ ## <a name="ec2">ec2</a>
917
+
918
+ EC2 resource type.
919
+
920
+ ### exist
921
+
922
+ ```ruby
923
+ describe ec2('my-ec2') do
924
+ it { should exist }
925
+ end
926
+ ```
927
+
928
+
929
+ ### be_disabled_api_termination
930
+
931
+ ```ruby
932
+ describe ec2('my-ec2') do
933
+ it { should be_disabled_api_termination }
934
+ end
935
+ ```
936
+
937
+
938
+ ### be_pending, be_running, be_shutting_down, be_terminated, be_stopping, be_stopped
939
+
940
+ ```ruby
941
+ describe ec2('my-ec2') do
942
+ it { should be_running }
943
+ end
944
+ ```
945
+
946
+
947
+ ### have_classiclink
948
+
949
+ ```ruby
950
+ describe ec2('my-ec2-classic') do
951
+ it { should have_classiclink('my-vpc') }
952
+ end
953
+ ```
954
+
955
+
956
+ ### have_classiclink_security_group
957
+
958
+ ```ruby
959
+ describe ec2('my-ec2-classic') do
960
+ it { should have_classiclink_security_group('sg-2a3b4cd5') }
961
+ it { should have_classiclink_security_group('my-vpc-security-group-name') }
962
+ end
963
+ ```
964
+
965
+
966
+ ### have_credit_specification
967
+
968
+ The credit option for CPU usage of T2 or T3 instance.
969
+
970
+ ```ruby
971
+ describe ec2('my-ec2') do
972
+ it { should have_credit_specification('unlimited') }
973
+ end
974
+ ```
975
+
976
+
977
+ ### have_ebs
978
+
979
+ ```ruby
980
+ describe ec2('my-ec2') do
981
+ it { should have_ebs('vol-123a123b') }
982
+ it { should have_ebs('my-volume') }
983
+ end
984
+ ```
985
+
986
+
987
+ ### have_eip
988
+
989
+ ```ruby
990
+ describe ec2('my-ec2') do
991
+ it { should have_eip('123.0.456.789') }
992
+ end
993
+ ```
994
+
995
+
996
+ ### have_event
997
+
998
+ ```ruby
999
+ describe ec2('my-ec2') do
1000
+ it { should have_event('system-reboot') }
1001
+ end
1002
+ ```
1003
+
1004
+
1005
+ ### have_events
1006
+
1007
+ ```ruby
1008
+ describe ec2('my-ec2') do
1009
+ it { should_not have_events }
1010
+ end
1011
+ ```
1012
+
1013
+
1014
+ ### have_iam_instance_profile
1015
+
1016
+ ```ruby
1017
+ describe ec2('my-ec2') do
1018
+ it { should have_iam_instance_profile('Ec2IamProfileName') }
1019
+ end
1020
+ ```
1021
+
1022
+
1023
+ ### have_network_interface
1024
+
1025
+ ```ruby
1026
+ describe ec2('my-ec2') do
1027
+ it { should have_network_interface('my-eni') }
1028
+ it { should have_network_interface('eni-12ab3cde') }
1029
+ it { should have_network_interface('my-eni').as_eth0 }
1030
+ end
1031
+ ```
1032
+
1033
+
1034
+ ### have_security_group
1035
+
1036
+ ```ruby
1037
+ describe ec2('my-ec2') do
1038
+ it { should have_security_group('my-security-group-name') }
1039
+ it { should have_security_group('sg-1a2b3cd4') }
1040
+ end
1041
+ ```
1042
+
1043
+
1044
+ ### have_security_groups
1045
+
1046
+ ```ruby
1047
+ describe ec2('my-ec2') do
1048
+ it { should have_security_groups(['my-security-group-name-1', 'my-security-group-name-2']) }
1049
+ it { should have_security_groups(['sg-1a2b3cd4', 'sg-5e6f7gh8']) }
1050
+ end
1051
+ ```
1052
+
1053
+
1054
+ ### have_tag
1055
+
1056
+ ```ruby
1057
+ describe ec2('my-ec2') do
1058
+ it { should have_tag('Name').value('my-ec2') }
1059
+ end
1060
+ ```
1061
+
1062
+
1063
+ ### belong_to_subnet
1064
+
1065
+ ```ruby
1066
+ describe ec2('my-ec2') do
1067
+ it { should belong_to_subnet('subnet-1234a567') }
1068
+ it { should belong_to_subnet('my-subnet') }
1069
+ end
1070
+ ```
1071
+
1072
+
1073
+ ### belong_to_vpc
1074
+
1075
+ ```ruby
1076
+ describe ec2('my-ec2') do
1077
+ it { should belong_to_vpc('vpc-ab123cde') }
1078
+ it { should belong_to_vpc('my-vpc') }
1079
+ end
1080
+ ```
1081
+
1082
+
1083
+ ### its(:ami_launch_index), its(:image_id), its(:instance_id), its(:instance_type), its(:kernel_id), its(:key_name), its(:launch_time), its(:monitoring), its(:placement), its(:platform), its(:private_dns_name), its(:private_ip_address), its(:product_codes), its(:public_dns_name), its(:public_ip_address), its(:ramdisk_id), its(:state_transition_reason), its(:subnet_id), its(:vpc_id), its(:architecture), its(:client_token), its(:ebs_optimized), its(:ena_support), its(:hypervisor), its(:instance_lifecycle), its(:elastic_gpu_associations), its(:elastic_inference_accelerator_associations), its(:outpost_arn), its(:root_device_name), its(:root_device_type), its(:source_dest_check), its(:spot_instance_request_id), its(:sriov_net_support), its(:state_reason), its(:virtualization_type), its(:cpu_options), its(:capacity_reservation_id), its(:capacity_reservation_specification), its(:hibernation_options), its(:licenses), its(:metadata_options)
1084
+ ### :unlock: Advanced use
1085
+
1086
+ `ec2` can use `Aws::EC2::Instance` resource (see http://docs.aws.amazon.com/sdkforruby/api/Aws/EC2/Instance.html).
1087
+
1088
+ ```ruby
1089
+ describe ec2('my-ec2') do
1090
+ its('vpc.id') { should eq 'vpc-ab123cde' }
1091
+ end
1092
+ ```
1093
+
1094
+ or
1095
+
1096
+ ```ruby
1097
+ describe ec2('my-ec2') do
1098
+ its('resource.vpc.id') { should eq 'vpc-ab123cde' }
1099
+ end
1100
+ ```
1101
+
1102
+ #### Awspec::DuplicatedResourceTypeError exception
1103
+
1104
+ EC2 resources might have the same tag value and if you try to search for a
1105
+ specific instance using that tag/tag value you might found multiples results
1106
+ and receive a `Awspec::DuplicatedResourceTypeError` exception as result.
1107
+
1108
+ To avoid such situations, you will want to use EC2 instances ID's and then use
1109
+ those ID's to test whatever you need.
1110
+
1111
+ There are several different ways to provide such ID's, like using [Terraform output](https://www.terraform.io/docs/configuration/outputs.html) or even the
1112
+ AWS SDK directly:
1113
+
1114
+ ```ruby
1115
+ require 'awspec'
1116
+ require 'aws-sdk-ec2'
1117
+
1118
+ tag_name = 'tag:Name'
1119
+ tag_value = 'foobar'
1120
+ servers = {}
1121
+ ec2 = Aws::EC2::Resource.new
1122
+ ec2.instances({filters: [{name: "#{tag_name}",
1123
+ values: ["#{tag_value}"]}]}).each do |i|
1124
+ servers.store(i.id, i.subnet_id)
1125
+ end
1126
+
1127
+ if servers.size == 0
1128
+ raise "Could not find any EC2 instance with #{tag_name} = #{tag_value}!"
1129
+ end
1130
+
1131
+ servers.each_pair do |instance_id, subnet_id|
1132
+ describe ec2(instance_id) do
1133
+ it { should exist }
1134
+ it { should be_running }
1135
+ its(:image_id) { should eq 'ami-12345foobar' }
1136
+ its(:instance_type) { should eq 't2.micro' }
1137
+ it { should belong_to_subnet(subnet_id) }
1138
+ end
1139
+ end
1140
+ ```
1141
+
1142
+ ## <a name="ecr_repository">ecr_repository</a>
1143
+
1144
+ EcrRepository resource type.
1145
+
1146
+ ### exist
1147
+
1148
+
1149
+ ## <a name="ecs_cluster">ecs_cluster</a>
1150
+
1151
+ ECS Cluster resource type.
1152
+
1153
+ ### exist
1154
+
1155
+ ```ruby
1156
+ describe ecs_cluster('my-ecs-cluster') do
1157
+ it { should exist }
1158
+ end
1159
+ ```
1160
+
1161
+
1162
+ ### be_active, be_inactive
1163
+
1164
+ ```ruby
1165
+ describe ecs_cluster('my-ecs-cluster') do
1166
+ it { should be_active }
1167
+ end
1168
+ ```
1169
+
1170
+
1171
+ ### have_container_instance
1172
+
1173
+ ```ruby
1174
+ describe ecs_cluster('my-ecs-cluster') do
1175
+ it { have_container_instance('f2756532-8f13-4d53-87c9-aed50dc94cd7') }
1176
+ end
1177
+ ```
1178
+
1179
+ ### its(:cluster_arn), its(:cluster_name), its(:status), its(:registered_container_instances_count), its(:running_tasks_count), its(:pending_tasks_count), its(:active_services_count), its(:statistics), its(:tags), its(:settings), its(:capacity_providers), its(:default_capacity_provider_strategy), its(:attachments), its(:attachments_status)
1180
+ ## <a name="ecs_container_instance">ecs_container_instance</a>
1181
+
1182
+ ECS Container Instance resource type.
1183
+
1184
+ ### exist
1185
+
1186
+ You can set `cluster` ( default: `default` ).
1187
+
1188
+ ```ruby
1189
+ describe ecs_container_instance('my-container-instance'), cluster: 'my-ecs-cluster' do
1190
+ it { should exist }
1191
+ end
1192
+ ```
1193
+
1194
+
1195
+ ### be_active, be_inactive
1196
+
1197
+ ```ruby
1198
+ describe ecs_container_instance('my-container-instance'), cluster: 'my-ecs-cluster' do
1199
+ it { should be_active }
1200
+ end
1201
+ ```
1202
+
1203
+
1204
+ ### its(:container_instance_arn), its(:ec2_instance_id), its(:capacity_provider_name), its(:version), its(:version_info), its(:status), its(:status_reason), its(:agent_connected), its(:running_tasks_count), its(:pending_tasks_count), its(:agent_update_status), its(:attributes), its(:registered_at), its(:attachments), its(:tags)
1205
+ ## <a name="ecs_service">ecs_service</a>
1206
+
1207
+ ECS Service resource type.
1208
+
1209
+ ### exist
1210
+
1211
+ ```ruby
1212
+ describe ecs_service('my-ecs-service') do
1213
+ it { should exist }
1214
+ end
1215
+ ```
1216
+
1217
+
1218
+ ### be_active, be_draining, be_inactive
1219
+
1220
+ ```ruby
1221
+ describe ecs_service('my-ecs-service') do
1222
+ it { should be_active }
1223
+ end
1224
+ ```
1225
+
1226
+ ### its(:service_arn), its(:service_name), its(:cluster_arn), its(:load_balancers), its(:service_registries), its(:status), its(:desired_count), its(:running_count), its(:pending_count), its(:launch_type), its(:capacity_provider_strategy), its(:platform_version), its(:task_definition), its(:task_sets), its(:role_arn), its(:created_at), its(:placement_constraints), its(:placement_strategy), its(:network_configuration), its(:health_check_grace_period_seconds), its(:scheduling_strategy), its(:deployment_controller), its(:tags), its(:created_by), its(:enable_ecs_managed_tags), its(:propagate_tags)
1227
+ ## <a name="ecs_task_definition">ecs_task_definition</a>
1228
+
1229
+ ECS Task Definition resource type.
1230
+
1231
+ ### exist
1232
+
1233
+ ```ruby
1234
+ describe ecs_task_definition('my-ecs-task-definition') do
1235
+ it { should exist }
1236
+ end
1237
+ ```
1238
+
1239
+
1240
+ ### be_active, be_inactive
1241
+
1242
+ ```ruby
1243
+ describe ecs_task_definition('my-ecs-task-definition') do
1244
+ it { should be_active }
1245
+ end
1246
+ ```
1247
+
1248
+ ### its(:task_definition_arn), its(:family), its(:task_role_arn), its(:execution_role_arn), its(:network_mode), its(:revision), its(:volumes), its(:status), its(:requires_attributes), its(:placement_constraints), its(:compatibilities), its(:requires_compatibilities), its(:cpu), its(:memory), its(:inference_accelerators), its(:pid_mode), its(:ipc_mode), its(:proxy_configuration)
1249
+ ## <a name="efs">efs</a>
1250
+
1251
+ EFS resource type.
1252
+
1253
+ ### exist
1254
+
1255
+ ```ruby
1256
+ describe efs('my-efs') do
1257
+ it { should exist }
1258
+ end
1259
+ ```
1260
+
1261
+
1262
+ ### have_tag
1263
+
1264
+ ```ruby
1265
+ describe efs('my-efs') do
1266
+ it { should have_tag('my-key').value('my-value') }
1267
+ end
1268
+ ```
1269
+
1270
+ ### its(:owner_id), its(:creation_token), its(:file_system_id), its(:creation_time), its(:life_cycle_state), its(:name), its(:number_of_mount_targets), its(:performance_mode), its(:encrypted), its(:kms_key_id), its(:throughput_mode), its(:provisioned_throughput_in_mibps)
1271
+ ## <a name="elastic_ip">elastic_ip</a>
1272
+
1273
+ Elastic IP resource type.
1274
+
1275
+ ### exist
1276
+
1277
+ ```ruby
1278
+ describe eip('123.0.456.789') do
1279
+ it { should exist }
1280
+ end
1281
+ ```
1282
+
1283
+
1284
+ ### be_associated_to
1285
+
1286
+ ```ruby
1287
+ describe eip('123.0.456.789') do
1288
+ it { should be_associated_to('i-ec12345a') }
1289
+ end
1290
+ ```
1291
+
1292
+
1293
+ ### belong_to_domain
1294
+
1295
+ ```ruby
1296
+ describe eip('123.0.456.789') do
1297
+ it { should belong_to_domain('vpc') }
1298
+ end
1299
+ ```
1300
+
1301
+
1302
+ ## <a name="eks">eks</a>
1303
+
1304
+ Eks resource type.
1305
+
1306
+ ### exist
1307
+
1308
+ ```ruby
1309
+ describe eks('my-eks') do
1310
+ it { should exist }
1311
+ end
1312
+ ```
1313
+
1314
+ ### be_active, be_creating
1315
+
1316
+ ```ruby
1317
+ describe eks('my-eks') do
1318
+ it { should be_active }
1319
+ end
1320
+ ```
1321
+
1322
+ ### its(:name), its(:arn), its(:created_at), its(:version), its(:endpoint), its(:role_arn), its(:logging), its(:identity), its(:status), its(:client_request_token), its(:platform_version), its(:tags)
1323
+ ## <a name="elasticache">elasticache</a>
1324
+
1325
+ Elasticache resource type.
1326
+
1327
+ ### exist
1328
+
1329
+ ```ruby
1330
+ describe elasticache('my-rep-group-001') do
1331
+ it { should exist }
1332
+ end
1333
+ ```
1334
+
1335
+
1336
+ ### be_available, be_creating, be_deleted, be_deleting, be_incompatible_network, be_modifying, be_rebooting_cache_cluster_nodes, be_restore_failed, be_snapshotting
1337
+
1338
+ ```ruby
1339
+ describe elasticache('my-rep-group-001') do
1340
+ it { should be_available }
1341
+ end
1342
+ ```
1343
+
1344
+
1345
+ ### have_cache_parameter_group
1346
+
1347
+ ```ruby
1348
+ describe elasticache('my-rep-group-001') do
1349
+ it { should have_cache_parameter_group('my-cache-parameter-group') }
1350
+ end
1351
+ ```
1352
+
1353
+
1354
+ ### have_security_group
1355
+
1356
+ ```ruby
1357
+ describe elasticache('my-rep-group-001') do
1358
+ it { should have_security_group('sg-da1bc2ef') }
1359
+ it { should have_security_group('group-name-sg') }
1360
+ it { should have_security_group('my-cache-sg') }
1361
+ end
1362
+ ```
1363
+
1364
+
1365
+ ### belong_to_cache_subnet_group
1366
+
1367
+ ```ruby
1368
+ describe elasticache('my-rep-group-001') do
1369
+ it { should belong_to_cache_subnet_group('my-cache-subnet-group') }
1370
+ end
1371
+ ```
1372
+
1373
+
1374
+ ### belong_to_replication_group
1375
+
1376
+ ```ruby
1377
+ describe elasticache('my-rep-group-001') do
1378
+ it { should belong_to_replication_group('my-rep-group') }
1379
+ end
1380
+ ```
1381
+
1382
+
1383
+ ### belong_to_vpc
1384
+
1385
+ ```ruby
1386
+ describe elasticache('my-rep-group-001') do
1387
+ it { should belong_to_vpc('my-vpc') }
1388
+ end
1389
+ ```
1390
+
1391
+ ### its(:cache_cluster_id), its(:configuration_endpoint), its(:client_download_landing_page), its(:cache_node_type), its(:engine), its(:engine_version), its(:cache_cluster_status), its(:num_cache_nodes), its(:preferred_availability_zone), its(:cache_cluster_create_time), its(:preferred_maintenance_window), its(:notification_configuration), its(:cache_security_groups), its(:cache_subnet_group_name), its(:cache_nodes), its(:auto_minor_version_upgrade), its(:replication_group_id), its(:snapshot_retention_limit), its(:snapshot_window), its(:auth_token_enabled), its(:auth_token_last_modified_date), its(:transit_encryption_enabled), its(:at_rest_encryption_enabled)
1392
+ ## <a name="elasticache_cache_parameter_group">elasticache_cache_parameter_group</a>
1393
+
1394
+ ElasticacheCacheParameterGroup resource type.
1395
+
1396
+ ```ruby
1397
+ describe elasticache_cache_parameter_group('my-cache-parameter-group') do
1398
+ it { should exist }
1399
+ its(:activerehashing) { should eq 'yes' }
1400
+ its(:client_output_buffer_limit_pubsub_hard_limit) { should eq '33554432' }
1401
+ end
1402
+ ```
1403
+
1404
+
1405
+ ### exist
1406
+
1407
+ ```ruby
1408
+ describe elasticache_cache_parameter_group('my-cache-parameter-group') do
1409
+ it { should exist }
1410
+ end
1411
+ ```
1412
+
1413
+
1414
+ ## <a name="elasticsearch">elasticsearch</a>
1415
+
1416
+ Elasticsearch resource type.
1417
+
1418
+ ### exist
1419
+
1420
+ ```ruby
1421
+ describe elasticsearch('my-elasticsearch') do
1422
+ it { should exist }
1423
+ end
1424
+ ```
1425
+
1426
+
1427
+ ### be_created
1428
+
1429
+ ```ruby
1430
+ describe elasticsearch('my-elasticsearch') do
1431
+ it { should be_created }
1432
+ end
1433
+ ```
1434
+
1435
+
1436
+ ### be_deleted
1437
+
1438
+ ```ruby
1439
+ describe elasticsearch('my-elasticsearch') do
1440
+ it { should be_deleted }
1441
+ end
1442
+ ```
1443
+
1444
+
1445
+ ### have_access_policies
1446
+
1447
+ ```ruby
1448
+ describe elasticsearch('my-elasticsearch') do
1449
+ it do
1450
+ should have_access_policies <<-policy
1451
+ {
1452
+ "version": "2012-10-17",
1453
+ "statement": [
1454
+ {
1455
+ "effect": "allow",
1456
+ "principal": "*",
1457
+ "action": [
1458
+ "es:*"
1459
+ ],
1460
+ "resource": "arn:aws:es:ap-northeast-1:1234567890:domain/my-elasticsearch/*"
1461
+ }
1462
+ ]
1463
+ }
1464
+ policy
1465
+ end
1466
+ end
1467
+ ```
1468
+
1469
+
1470
+ ### its(:domain_id), its(:domain_name), its(:arn), its(:created), its(:deleted), its(:endpoint), its(:endpoints), its(:processing), its(:upgrade_processing), its(:elasticsearch_version), its(:access_policies), its(:snapshot_options), its(:vpc_options), its(:cognito_options), its(:encryption_at_rest_options), its(:node_to_node_encryption_options), its(:advanced_options), its(:log_publishing_options), its(:service_software_options), its(:domain_endpoint_options)
1471
+ ## <a name="elastictranscoder_pipeline">elastictranscoder_pipeline</a>
1472
+
1473
+ ElastictranscoderPipeline resource type.
1474
+
1475
+ ### exist
1476
+
1477
+ ### be_active, be_paused
1478
+
1479
+ ```ruby
1480
+ describe elastictranscoder_pipeline('my-elastictranscoder-pipeline') do
1481
+ it { should be_active }
1482
+ end
1483
+ ```
1484
+
1485
+
1486
+ ## <a name="elb">elb</a>
1487
+
1488
+ ELB resource type.
1489
+
1490
+ ### exist
1491
+
1492
+ ```ruby
1493
+ describe elb('my-elb') do
1494
+ it { should exist }
1495
+ end
1496
+ ```
1497
+
1498
+
1499
+ ### be_cross_zone_load_balancing_enabled
1500
+
1501
+ ```ruby
1502
+ describe elb('my-elb') do
1503
+ it { should be_cross_zone_load_balancing_enabled }
1504
+ end
1505
+ ```
1506
+
1507
+
1508
+ ### have_access_log
1509
+
1510
+ ```ruby
1511
+ describe elb('my-elb') do
1512
+ it { should have_access_log(s3_bucket_name: 'my-loadbalancer-logs', s3_bucket_prefix: 'my-app', emit_interval: 5) }
1513
+ end
1514
+ ```
1515
+
1516
+
1517
+ ### have_connection_draining
1518
+
1519
+ ```ruby
1520
+ describe elb('my-elb') do
1521
+ it { should have_connection_draining(timeout: 300) }
1522
+ end
1523
+ ```
1524
+
1525
+ ### have_ec2
1526
+
1527
+ ```ruby
1528
+ describe elb('my-elb') do
1529
+ it { should have_ec2('my-ec2') }
1530
+ end
1531
+ ```
1532
+
1533
+
1534
+ ### have_listener
1535
+
1536
+ http://docs.aws.amazon.com/en_us/ElasticLoadBalancing/latest/DeveloperGuide/elb-listener-config.html
1537
+
1538
+ ```ruby
1539
+ describe elb('my-elb') do
1540
+ it { should have_listener(protocol: 'HTTPS', port: 443, instance_protocol: 'HTTP', instance_port: 80) }
1541
+ end
1542
+ ```
1543
+
1544
+
1545
+ ### have_security_group
1546
+
1547
+ ```ruby
1548
+ describe elb('my-elb') do
1549
+ it { should have_security_group('my-lb-security-group-tag-name') }
1550
+ end
1551
+ ```
1552
+
1553
+
1554
+ ### have_subnet
1555
+
1556
+ ```ruby
1557
+ describe elb('my-elb') do
1558
+ it { should have_subnet('my-subnet') }
1559
+ end
1560
+ ```
1561
+
1562
+
1563
+ ### have_tag
1564
+
1565
+ ```ruby
1566
+ describe elb('my-elb') do
1567
+ it { should have_tag('Name').value('my-elb') }
1568
+ it { should have_tag('my-tag-key').value('my-tag-value') }
1569
+ end
1570
+ ```
1571
+
1572
+
1573
+ ### belong_to_vpc
1574
+
1575
+ ```ruby
1576
+ describe elb('my-elb') do
1577
+ it { should belong_to_vpc('my-vpc') }
1578
+ end
1579
+ ```
1580
+
1581
+
1582
+ ### its(:health_check_target), its(:health_check_interval), its(:health_check_timeout), its(:health_check_unhealthy_threshold), its(:health_check_healthy_threshold), its(:idle_timeout), its(:load_balancer_name), its(:dns_name), its(:canonical_hosted_zone_name), its(:canonical_hosted_zone_name_id), its(:backend_server_descriptions), its(:availability_zones), its(:subnets), its(:vpc_id), its(:security_groups), its(:created_time), its(:scheme)
1583
+ ## <a name="emr">emr</a>
1584
+
1585
+ Emr resource type.
1586
+
1587
+ ### exist
1588
+
1589
+ ```ruby
1590
+ describe emr('my-emr') do
1591
+ it { should exist }
1592
+ end
1593
+ ```
1594
+
1595
+ ### be_healthy
1596
+
1597
+ ```ruby
1598
+ describe emr('my-emr') do
1599
+ it { should be_healthy }
1600
+ end
1601
+ ```
1602
+
1603
+ ### be_ok
1604
+
1605
+ ### be_ready
1606
+
1607
+ ### be_running, be_waiting, be_starting, be_bootstrapping
1608
+
1609
+ ```ruby
1610
+ describe emr('my-emr') do
1611
+ it { should be_running }
1612
+ end
1613
+ ```
1614
+
1615
+ ### its(:id), its(:name), its(:instance_collection_type), its(:log_uri), its(:requested_ami_version), its(:running_ami_version), its(:release_label), its(:auto_terminate), its(:termination_protected), its(:visible_to_all_users), its(:service_role), its(:normalized_instance_hours), its(:master_public_dns_name), its(:configurations), its(:security_configuration), its(:auto_scaling_role), its(:scale_down_behavior), its(:custom_ami_id), its(:ebs_root_volume_size), its(:repo_upgrade_on_boot), its(:cluster_arn), its(:step_concurrency_level), its(:outpost_arn)
1616
+ ## <a name="firehose">firehose</a>
1617
+
1618
+ Firehose resource type.
1619
+
1620
+ ### exist
1621
+
1622
+ ```ruby
1623
+ describe firehose('my-firehose') do
1624
+ it { should exist }
1625
+ end
1626
+ ```
1627
+
1628
+
1629
+ ### be_active
1630
+
1631
+ ```ruby
1632
+ describe firehose('my-firehose') do
1633
+ it { should be_active }
1634
+ end
1635
+ ```
1636
+
1637
+
1638
+ ### be_creating
1639
+
1640
+ ### be_deleting
1641
+
1642
+ ### have_splunk_destination
1643
+
1644
+ ```ruby
1645
+ describe firehose('my-firehose') do
1646
+ it { should have_splunk_destination }
1647
+ end
1648
+ ```
1649
+
1650
+
1651
+ ### its(:delivery_stream_name), its(:delivery_stream_arn), its(:delivery_stream_status), its(:failure_description), its(:delivery_stream_encryption_configuration), its(:delivery_stream_type), its(:version_id), its(:create_timestamp), its(:last_update_timestamp), its(:source), its(:has_more_destinations)
1652
+ ### :unlock: Advanced use
1653
+
1654
+ ```ruby
1655
+ describe firehose('my-firehose') do
1656
+ its(:delivery_stream_type) { should be_eql('DirectPut') }
1657
+ end
1658
+ ```
1659
+
1660
+ ## <a name="iam_group">iam_group</a>
1661
+
1662
+ IamGroup resource type.
1663
+
1664
+ ### exist
1665
+
1666
+ ```ruby
1667
+ describe iam_group('my-iam-group') do
1668
+ it { should exist }
1669
+ end
1670
+ ```
1671
+
1672
+
1673
+ ### be_allowed_action
1674
+
1675
+ ```ruby
1676
+ describe iam_group('my-iam-group') do
1677
+ it { should be_allowed_action('ec2:DescribeInstances') }
1678
+ it { should be_allowed_action('s3:Put*').resource_arn('arn:aws:s3:::my-bucket-name/*') }
1679
+ end
1680
+ ```
1681
+
1682
+
1683
+ ### have_iam_policy
1684
+
1685
+ ```ruby
1686
+ describe iam_group('my-iam-group') do
1687
+ it { should have_iam_policy('ReadOnlyAccess') }
1688
+ end
1689
+ ```
1690
+
1691
+
1692
+ ### have_iam_user
1693
+
1694
+ ```ruby
1695
+ describe iam_group('my-iam-group') do
1696
+ it { should have_iam_user('my-iam-user') }
1697
+ end
1698
+ ```
1699
+
1700
+
1701
+ ### have_inline_policy
1702
+
1703
+ ```ruby
1704
+ describe iam_group('my-iam-group') do
1705
+ it { should have_inline_policy('InlineEC2FullAccess') }
1706
+ it do
1707
+ should have_inline_policy('InlineEC2FullAccess').policy_document(<<-'DOC')
1708
+ {
1709
+ "Statement": [
1710
+ {
1711
+ "Action": "ec2:*",
1712
+ "Effect": "Allow",
1713
+ "Resource": "*"
1714
+ },
1715
+ {
1716
+ "Effect": "Allow",
1717
+ "Action": "elasticloadbalancing:*",
1718
+ "Resource": "*"
1719
+ },
1720
+ {
1721
+ "Effect": "Allow",
1722
+ "Action": "cloudwatch:*",
1723
+ "Resource": "*"
1724
+ },
1725
+ {
1726
+ "Effect": "Allow",
1727
+ "Action": "autoscaling:*",
1728
+ "Resource": "*"
1729
+ }
1730
+ ]
1731
+ }
1732
+ DOC
1733
+ end
1734
+ end
1735
+ ```
1736
+
1737
+ You can test absence of inline policies.
1738
+
1739
+ ```ruby
1740
+ describe iam_group('my-iam-group') do
1741
+ it { should_not have_inline_policy }
1742
+ end
1743
+ ```
1744
+
1745
+
1746
+ ### its(:path), its(:group_name), its(:group_id), its(:arn), its(:create_date)
1747
+ ### :unlock: Advanced use
1748
+
1749
+ `iam_group` can use `Aws::IAM::Group` resource (see http://docs.aws.amazon.com/sdkforruby/api/Aws/IAM/Group.html).
1750
+
1751
+ ```ruby
1752
+ describe iam_group('my-iam-group') do
1753
+ its('users.count') { should eq 5 }
1754
+ end
1755
+ ```
1756
+
1757
+ or
1758
+
1759
+ ```ruby
1760
+ describe iam_group('my-iam-group') do
1761
+ its('resource.users.count') { should eq 5 }
1762
+ end
1763
+ ```
1764
+
1765
+ ## <a name="iam_policy">iam_policy</a>
1766
+
1767
+ IamPolicy resource type.
1768
+
1769
+ ### exist
1770
+
1771
+ ```ruby
1772
+ describe iam_policy('my-iam-policy') do
1773
+ it { should exist }
1774
+ end
1775
+ ```
1776
+
1777
+
1778
+ ### be_attachable
1779
+
1780
+ ```ruby
1781
+ describe iam_policy('my-iam-policy') do
1782
+ it { should be_attachable }
1783
+ end
1784
+ ```
1785
+
1786
+
1787
+ ### be_attached_to_group
1788
+
1789
+ ```ruby
1790
+ describe iam_policy('my-iam-policy') do
1791
+ it { should be_attached_to_group('my-iam-group') }
1792
+ end
1793
+ ```
1794
+
1795
+
1796
+ ### be_attached_to_role
1797
+
1798
+ ```ruby
1799
+ describe iam_policy('my-iam-policy') do
1800
+ it { should be_attached_to_role('HelloIAmGodRole') }
1801
+ end
1802
+ ```
1803
+
1804
+
1805
+ ### be_attached_to_user
1806
+
1807
+ ```ruby
1808
+ describe iam_policy('my-iam-user') do
1809
+ it { should be_attached_to_user('my-iam-user') }
1810
+ end
1811
+ ```
1812
+
1813
+ ### its(:policy_name), its(:policy_id), its(:arn), its(:path), its(:default_version_id), its(:attachment_count), its(:permissions_boundary_usage_count), its(:is_attachable), its(:description), its(:create_date), its(:update_date)
1814
+ ## <a name="iam_role">iam_role</a>
1815
+
1816
+ IamRole resource type.
1817
+
1818
+ ### exist
1819
+
1820
+ ```ruby
1821
+ describe iam_role('my-iam-role') do
1822
+ it { should exist }
1823
+ end
1824
+ ```
1825
+
1826
+
1827
+ ### be_allowed_action
1828
+
1829
+ ```ruby
1830
+ describe iam_role('my-iam-role') do
1831
+ it { should be_allowed_action('ec2:DescribeInstances') }
1832
+ it { should be_allowed_action('s3:Put*').resource_arn('arn:aws:s3:::my-bucket-name/*') }
1833
+ end
1834
+ ```
1835
+
1836
+
1837
+ ### have_iam_policy
1838
+
1839
+ ```ruby
1840
+ describe iam_role('my-iam-role') do
1841
+ it { should have_iam_policy('ReadOnlyAccess') }
1842
+ end
1843
+ ```
1844
+
1845
+
1846
+ ### have_inline_policy
1847
+
1848
+ ```ruby
1849
+ describe iam_role('my-iam-role') do
1850
+ it { should have_inline_policy('AllowS3BucketAccess') }
1851
+ it do
1852
+ should have_inline_policy('AllowS3BucketAccess').policy_document(<<-'DOC')
1853
+ {
1854
+ "Statement": [
1855
+ {
1856
+ "Action": [
1857
+ "s3:ListAllMyBuckets"
1858
+ ],
1859
+ "Effect": "Allow",
1860
+ "Resource": "arn:aws:s3:::*"
1861
+ },
1862
+ {
1863
+ "Action": "s3:*",
1864
+ "Effect": "Allow",
1865
+ "Resource": ["arn:aws:s3:::my-bucket", "arn:aws:s3:::my-bucket/*"]
1866
+ }
1867
+ ]
1868
+ }
1869
+ DOC
1870
+ end
1871
+ end
1872
+ ```
1873
+
1874
+ You can test absence of inline policies.
1875
+
1876
+ ```ruby
1877
+ describe iam_role('my-iam-role') do
1878
+ it { should_not have_inline_policy }
1879
+ end
1880
+ ```
1881
+
1882
+
1883
+ ### its(:path), its(:role_name), its(:role_id), its(:arn), its(:create_date), its(:assume_role_policy_document), its(:description), its(:max_session_duration), its(:permissions_boundary), its(:tags), its(:role_last_used)
1884
+ ### :unlock: Advanced use
1885
+
1886
+ `iam_role` can use `Aws::IAM::Role` resource (see http://docs.aws.amazon.com/sdkforruby/api/Aws/IAM/Role.html).
1887
+
1888
+ ```ruby
1889
+ describe iam_role('my-iam-role') do
1890
+ its('attached_policies.count') { should eq 5 }
1891
+ end
1892
+ ```
1893
+
1894
+ or
1895
+
1896
+ ```ruby
1897
+ describe iam_role('my-iam-role') do
1898
+ its('resource.attached_policies.count') { should eq 5 }
1899
+ end
1900
+ ```
1901
+
1902
+ ## <a name="iam_user">iam_user</a>
1903
+
1904
+ IamUser resource type.
1905
+
1906
+ ### exist
1907
+
1908
+ ```ruby
1909
+ describe iam_user('my-iam-user') do
1910
+ it { should exist }
1911
+ end
1912
+ ```
1913
+
1914
+
1915
+ ### be_allowed_action
1916
+
1917
+ ```ruby
1918
+ describe iam_user('my-iam-user') do
1919
+ it { should be_allowed_action('ec2:DescribeInstances') }
1920
+ it { should be_allowed_action('s3:Put*').resource_arn('arn:aws:s3:::my-bucket-name/*') }
1921
+ end
1922
+ ```
1923
+
1924
+
1925
+ ### have_iam_policy
1926
+
1927
+ ```ruby
1928
+ describe iam_user('my-iam-user') do
1929
+ it { should have_iam_policy('ReadOnlyAccess') }
1930
+ end
1931
+ ```
1932
+
1933
+
1934
+ ### have_inline_policy
1935
+
1936
+ ```ruby
1937
+ describe iam_user('my-iam-user') do
1938
+ it { should have_inline_policy('AllowS3BucketAccess') }
1939
+ it do
1940
+ should have_inline_policy('AllowS3BucketAccess').policy_document(<<-'DOC')
1941
+ {
1942
+ "Statement": [
1943
+ {
1944
+ "Action": [
1945
+ "s3:ListAllMyBuckets"
1946
+ ],
1947
+ "Effect": "Allow",
1948
+ "Resource": "arn:aws:s3:::*"
1949
+ },
1950
+ {
1951
+ "Action": "s3:*",
1952
+ "Effect": "Allow",
1953
+ "Resource": ["arn:aws:s3:::my-bucket", "arn:aws:s3:::my-bucket/*"]
1954
+ }
1955
+ ]
1956
+ }
1957
+ DOC
1958
+ end
1959
+ end
1960
+ ```
1961
+
1962
+ You can test absence of inline policies.
1963
+
1964
+ ```ruby
1965
+ describe iam_user('my-iam-user') do
1966
+ it { should_not have_inline_policy }
1967
+ end
1968
+ ```
1969
+
1970
+
1971
+ ### belong_to_iam_group
1972
+
1973
+ ```ruby
1974
+ describe iam_user('my-iam-user') do
1975
+ it { should belong_to_iam_group('my-iam-group') }
1976
+ end
1977
+ ```
1978
+
1979
+
1980
+ ### its(:path), its(:user_name), its(:user_id), its(:arn), its(:create_date), its(:password_last_used), its(:permissions_boundary), its(:tags)
1981
+ ### :unlock: Advanced use
1982
+
1983
+ `iam_user` can use `Aws::IAM::User` resource (see http://docs.aws.amazon.com/sdkforruby/api/Aws/IAM/User.html).
1984
+
1985
+ ```ruby
1986
+ describe iam_user('my-iam-user') do
1987
+ its('login_profile.password_reset_required') { should eq false }
1988
+ end
1989
+ ```
1990
+
1991
+ or
1992
+
1993
+ ```ruby
1994
+ describe iam_user('my-iam-user') do
1995
+ its('resource.login_profile.password_reset_required') { should eq false }
1996
+ end
1997
+ ```
1998
+
1999
+ ## <a name="internet_gateway">internet_gateway</a>
2000
+
2001
+ InternetGateway resource type.
2002
+
2003
+ ### exist
2004
+
2005
+ ```ruby
2006
+ describe internet_gateway('igw-1ab2cd3e') do
2007
+ it { should exist }
2008
+ end
2009
+
2010
+ describe internet_gateway('my-internet-gateway') do
2011
+ it { should exist }
2012
+ end
2013
+ ```
2014
+
2015
+
2016
+ ### be_attached_to
2017
+
2018
+ ```ruby
2019
+ describe internet_gateway('igw-1ab2cd3e') do
2020
+ it { should be_attached_to('vpc-ab123cde') }
2021
+ end
2022
+
2023
+ describe internet_gateway('igw-1ab2cd3e') do
2024
+ it { should be_attached_to('my-vpc') }
2025
+ end
2026
+ ```
2027
+
2028
+
2029
+ ### have_tag
2030
+
2031
+ ```ruby
2032
+ describe internet_gateway('igw-1ab2cd3e') do
2033
+ it { should have_tag('Name').value('my-internet-gateway') }
2034
+ end
2035
+ ```
2036
+
2037
+ ### its(:internet_gateway_id), its(:owner_id)
2038
+ ## <a name="kinesis">kinesis</a>
2039
+
2040
+ Kinesis resource type.
2041
+
2042
+ ### exist
2043
+
2044
+ ```ruby
2045
+ describe kinesis('my-kinesis') do
2046
+ it { should exist }
2047
+ end
2048
+ ```
2049
+
2050
+ ### its(:stream_name), its(:stream_arn), its(:stream_status), its(:retention_period_hours), its(:stream_creation_timestamp), its(:encryption_type), its(:key_id), its(:open_shard_count), its(:consumer_count)
2051
+ ## <a name="kms">kms</a>
2052
+
2053
+ Kms resource type.
2054
+
2055
+ ### exist
2056
+
2057
+ ```ruby
2058
+ describe kms('my-kms-key') do
2059
+ it { should exist }
2060
+ end
2061
+ ```
2062
+
2063
+
2064
+ ### be_enabled
2065
+
2066
+ ```ruby
2067
+ describe kms('my-kms-key') do
2068
+ it { should be_enabled }
2069
+ end
2070
+ ```
2071
+
2072
+
2073
+ ### have_key_policy
2074
+
2075
+ ```ruby
2076
+ describe kms('my-kms-key') do
2077
+ it { should exist }
2078
+ it { should be_enabled }
2079
+ it do
2080
+ should have_key_policy('default').policy_document(<<-'DOC')
2081
+ {
2082
+ "Version" : "2012-10-17",
2083
+ "Id" : "key-consolepolicy-2",
2084
+ "Statement" : [ {
2085
+ "Sid" : "Enable IAM User Permissions",
2086
+ "Effect" : "Allow",
2087
+ "Principal" : {
2088
+ "AWS" : "arn:aws:iam::1234567890:root"
2089
+ },
2090
+ "Action" : "kms:*",
2091
+ "Resource" : "*"
2092
+ }, {
2093
+ "Sid" : "Allow access for Key Administrators",
2094
+ "Effect" : "Allow",
2095
+ "Principal" : {
2096
+ "AWS" : "arn:aws:iam::1234567890:user/test-user"
2097
+ },
2098
+ "Action" : [ "kms:Create*", "kms:Describe*", "kms:Enable*", "kms:List*", "kms:Put*", "kms:Update*", "kms:Revoke*", "kms:Disable*", "kms:Get*", "kms:Delete*", "kms:ScheduleKeyDeletion", "kms:CancelKeyDeletion" ],
2099
+ "Resource" : "*"
2100
+ }, {
2101
+ "Sid" : "Allow use of the key",
2102
+ "Effect" : "Allow",
2103
+ "Principal" : {
2104
+ "AWS" : [ "arn:aws:iam::1234567890:user/test-user", "arn:aws:iam::1234567890:role/test-role" ]
2105
+ },
2106
+ "Action" : [ "kms:Encrypt", "kms:Decrypt", "kms:ReEncrypt*", "kms:GenerateDataKey*", "kms:DescribeKey" ],
2107
+ "Resource" : "*"
2108
+ }, {
2109
+ "Sid" : "Allow attachment of persistent resources",
2110
+ "Effect" : "Allow",
2111
+ "Principal" : {
2112
+ "AWS" : [ "arn:aws:iam::1234567890:user/test-user", "arn:aws:iam::1234567890:role/test-role" ]
2113
+ },
2114
+ "Action" : [ "kms:CreateGrant", "kms:ListGrants", "kms:RevokeGrant" ],
2115
+ "Resource" : "*",
2116
+ "Condition" : {
2117
+ "Bool" : {
2118
+ "kms:GrantIsForAWSResource" : "true"
2119
+ }
2120
+ }
2121
+ } ]
2122
+ }
2123
+ DOC
2124
+ end
2125
+ end
2126
+ ```
2127
+
2128
+ ### its(:aws_account_id), its(:key_id), its(:arn), its(:creation_date), its(:enabled), its(:description), its(:key_usage), its(:key_state), its(:deletion_date), its(:valid_to), its(:origin), its(:custom_key_store_id), its(:cloud_hsm_cluster_id), its(:expiration_model), its(:key_manager), its(:customer_master_key_spec), its(:encryption_algorithms), its(:signing_algorithms)
2129
+ ## <a name="lambda">lambda</a>
2130
+
2131
+ Lambda resource type.
2132
+
2133
+ ### exist
2134
+
2135
+ ```ruby
2136
+ describe lambda('my-lambda-function-name') do
2137
+ it { should exist }
2138
+ end
2139
+ ```
2140
+
2141
+
2142
+ ### have_env_var
2143
+
2144
+ Useful to validate if there is a specific environment variable declared in the Lambda. You probably will want to use it with `have_env_var_value`.
2145
+
2146
+ ## have_env_var_value
2147
+
2148
+ Validates if a specific environment variable has the expected value. More useful to use with `have_env_var` because if the variable isn't available, it will fail without notifying that the variable is missing.
2149
+
2150
+ ```ruby
2151
+ expected.each_pair do |key, value|
2152
+ context "environment variable #{key}" do
2153
+ it { should have_env_var(key) }
2154
+ it { should have_env_var_value(key, value) }
2155
+ end
2156
+ end
2157
+ ```
2158
+
2159
+ `expected` would be a hash that has the environment variables names as keys.
2160
+
2161
+
2162
+ ### have_env_vars
2163
+
2164
+ Useful to validate if there are environment variables configured in the Lambda:
2165
+
2166
+ ```ruby
2167
+ describe lambda('my-lambda-function-name') do
2168
+ it { should have_env_vars() }
2169
+ end
2170
+ ```
2171
+
2172
+
2173
+ ### have_event_source
2174
+
2175
+ This matcher does not support Amazon S3 event sources ([see SDK doc](http://docs.aws.amazon.com/sdkforruby/api/Aws/Lambda/Client.html#list_event_source_mappings-instance_method)).
2176
+
2177
+ ### its(:function_name), its(:function_arn), its(:runtime), its(:role), its(:handler), its(:code_size), its(:description), its(:timeout), its(:memory_size), its(:last_modified), its(:code_sha_256), its(:version), its(:vpc_config), its(:dead_letter_config), its(:kms_key_arn), its(:master_arn), its(:revision_id), its(:layers), its(:state), its(:state_reason), its(:state_reason_code), its(:last_update_status), its(:last_update_status_reason), its(:last_update_status_reason_code)
2178
+ ## <a name="launch_configuration">launch_configuration</a>
2179
+
2180
+ LaunchConfiguration resource type.
2181
+
2182
+ ### exist
2183
+
2184
+ ```ruby
2185
+ describe launch_configuration('my-lc') do
2186
+ it { should exist }
2187
+ end
2188
+ ```
2189
+
2190
+
2191
+ ### have_block_device_mapping
2192
+
2193
+ ### have_security_group
2194
+
2195
+ ```ruby
2196
+ describe launch_configuration('my-lc') do
2197
+ it { should have_security_group('my-security-group-name') }
2198
+ end
2199
+ ```
2200
+
2201
+ ### its(:launch_configuration_name), its(:launch_configuration_arn), its(:image_id), its(:key_name), its(:security_groups), its(:classic_link_vpc_id), its(:classic_link_vpc_security_groups), its(:user_data), its(:instance_type), its(:kernel_id), its(:ramdisk_id), its(:spot_price), its(:iam_instance_profile), its(:created_time), its(:ebs_optimized), its(:associate_public_ip_address), its(:placement_tenancy)
2202
+ ## <a name="launch_template">launch_template</a>
2203
+
2204
+ LaunchTemplate resource type.
2205
+
2206
+ ### exist
2207
+
2208
+ You can set launch template version ( default: $Default ).
2209
+
2210
+ ```ruby
2211
+ # launch_template_id or launch_template_name
2212
+ describe launch_template('my-launch-template') do
2213
+ it { should exist }
2214
+ its(:default_version_number) { should eq 1 }
2215
+ its(:latest_version_number) { should eq 2 }
2216
+ its('launch_template_version.launch_template_data.image_id') { should eq 'ami-12345foobar' }
2217
+ its('launch_template_version.launch_template_data.instance_type') { should eq 't2.micro' }
2218
+ end
2219
+ ```
2220
+
2221
+ #### specify version
2222
+
2223
+ Specify "latest" or version_number.
2224
+
2225
+ ```ruby
2226
+ # version_number
2227
+ describe launch_template('my-launch-template'), version: 2 do
2228
+ it { should exist }
2229
+ its('launch_template_version.launch_template_data.instance_type') { should eq 't2.micro' }
2230
+ end
2231
+
2232
+ # latest
2233
+ describe launch_template('my-launch-template'), version: 'latest' do
2234
+ it { should exist }
2235
+ its('launch_template_version.launch_template_data.instance_type') { should eq 't2.micro' }
2236
+ end
2237
+ ```
2238
+
2239
+
2240
+ ### have_tag
2241
+
2242
+ ```ruby
2243
+ describe launch_template('my-launch-template') do
2244
+ it { should have_tag('env').value('dev') }
2245
+ end
2246
+ ```
2247
+
2248
+
2249
+ ### have_version_number
2250
+
2251
+ ```ruby
2252
+ describe launch_template('my-launch-template') do
2253
+ it { should have_version_number(2) }
2254
+ end
2255
+ ```
2256
+
2257
+ ### its(:launch_template_id), its(:launch_template_name), its(:create_time), its(:created_by), its(:default_version_number), its(:latest_version_number), its(:tags)
2258
+ ## <a name="mq">mq</a>
2259
+
2260
+ MQ resource type.
2261
+
2262
+ ### exist
2263
+
2264
+ ```ruby
2265
+ describe mq('my-mq') do
2266
+ it { should exist }
2267
+ end
2268
+ ```
2269
+
2270
+
2271
+ ### be_running, be_reboot_in_progress, be_creation_in_progress, be_creation_failed, be_deletion_in_progress
2272
+
2273
+ ```ruby
2274
+ describe mq('my-mq') do
2275
+ it { should be_running }
2276
+ end
2277
+ ```
2278
+
2279
+
2280
+ ### have_security_group
2281
+
2282
+ ```ruby
2283
+ describe mq('my-mq') do
2284
+ it { should have_security_group('sg-788eab237e47f1472') }
2285
+ it { should have_security_group('mq-group-name-sg') }
2286
+ it { should have_security_group('my-mq-sg') }
2287
+ end
2288
+ ```
2289
+
2290
+
2291
+ ### have_tag
2292
+
2293
+ ```ruby
2294
+ describe mq('my-mq') do
2295
+ it { should have_tag('Name').value('my-mq') }
2296
+ end
2297
+ ```
2298
+
2299
+ ### its(:vpc_id), its(:auto_minor_version_upgrade), its(:broker_arn), its(:broker_id), its(:broker_name), its(:broker_state), its(:created), its(:deployment_mode), its(:encryption_options), its(:engine_type), its(:engine_version), its(:host_instance_type), its(:pending_engine_version), its(:pending_host_instance_type), its(:pending_security_groups), its(:publicly_accessible), its(:security_groups), its(:storage_type), its(:subnet_ids)
2300
+ ## <a name="nat_gateway">nat_gateway</a>
2301
+
2302
+ NatGateway resource type.
2303
+
2304
+ ### exist
2305
+
2306
+ ```ruby
2307
+ describe nat_gateway('nat-7ff7777f') do
2308
+ it { should exist }
2309
+ end
2310
+ ```
2311
+
2312
+
2313
+ ### be_pending, be_failed, be_available, be_deleting, be_deleted
2314
+
2315
+ ```ruby
2316
+ describe nat_gateway('nat-7ff7777f') do
2317
+ it { should be_available }
2318
+ end
2319
+ ```
2320
+
2321
+
2322
+ ### have_eip
2323
+
2324
+ ```ruby
2325
+ describe nat_gateway('nat-7ff7777f') do
2326
+ it { should have_eip('123.0.456.789') }
2327
+ end
2328
+ ```
2329
+
2330
+
2331
+ ### have_tag
2332
+
2333
+ ```ruby
2334
+ describe nat_gateway('nat-7ff7777f') do
2335
+ it { should have_tag('Name').value('my-nat-gateway') }
2336
+ end
2337
+ ```
2338
+
2339
+ ### belong_to_vpc
2340
+
2341
+ ```ruby
2342
+ describe nat_gateway('nat-7ff7777f') do
2343
+ it { should belong_to_vpc('my-vpc') }
2344
+ end
2345
+ ```
2346
+
2347
+
2348
+ ### its(:create_time), its(:delete_time), its(:failure_code), its(:failure_message), its(:nat_gateway_id), its(:provisioned_bandwidth), its(:state), its(:subnet_id), its(:vpc_id)
2349
+ ## <a name="network_acl">network_acl</a>
2350
+
2351
+ NetworkAcl resource type.
2352
+
2353
+ ### exist
2354
+
2355
+ ```ruby
2356
+ describe network_acl('my-network-acl') do
2357
+ it { should exist }
2358
+ end
2359
+ ```
2360
+
2361
+
2362
+ ### have_subnet
2363
+
2364
+ ```ruby
2365
+ describe network_acl('my-network-acl') do
2366
+ it { should have_subnet('my-subnet') }
2367
+ end
2368
+ ```
2369
+
2370
+
2371
+ ### have_tag
2372
+
2373
+ ```ruby
2374
+ describe network_acl('my-network-acl') do
2375
+ it { should have_tag('Name').value('my-network-acl') }
2376
+ end
2377
+ ```
2378
+
2379
+
2380
+ ### belong_to_vpc
2381
+
2382
+ ```ruby
2383
+ describe network_acl('my-network-acl') do
2384
+ it { should belong_to_vpc('my-vpc') }
2385
+ end
2386
+ ```
2387
+
2388
+
2389
+ ### its(:inbound), its(:outbound), its(:inbound_entries_count), its(:outbound_entries_count)
2390
+
2391
+ ```ruby
2392
+ describe network_acl('my-network-acl') do
2393
+ its(:inbound) { should be_allowed(80).protocol('tcp').source('123.0.456.789/32') }
2394
+ its(:inbound) { should be_denied.rule_number('*').source('0.0.0.0/0') }
2395
+ its(:outbound) { should be_allowed.protocol('ALL').source('0.0.0.0/0') }
2396
+ its(:inbound_entries_count) { should eq 3 }
2397
+ its(:outbound_entries_count) { should eq 2 }
2398
+ end
2399
+ ```
2400
+
2401
+
2402
+ ### its(:inbound_entries_count), its(:outbound_entries_count), its(:is_default), its(:network_acl_id), its(:vpc_id), its(:owner_id)
2403
+ ### :unlock: Advanced use
2404
+
2405
+ `network_acl` can use `Aws::EC2::NetworkAcl` resource (see http://docs.aws.amazon.com/sdkforruby/api/Aws/EC2/NetworkAcl.html).
2406
+
2407
+ ```ruby
2408
+ describe network_acl('my-network-acl') do
2409
+ its('vpc.id') { should eq 'vpc-ab123cde' }
2410
+ end
2411
+ ```
2412
+
2413
+ or
2414
+
2415
+ ```ruby
2416
+ describe network_acl('my-network-acl') do
2417
+ its('resource.vpc.id') { should eq 'vpc-ab123cde' }
2418
+ end
2419
+ ```
2420
+
2421
+ ## <a name="network_interface">network_interface</a>
2422
+
2423
+ NetworkInterface resource type.
2424
+
2425
+ ### exist
2426
+
2427
+ ```ruby
2428
+ describe network_interface('eni-12ab3cde') do
2429
+ it { should exist }
2430
+ end
2431
+ ```
2432
+
2433
+
2434
+ ### be_attached_to
2435
+
2436
+ ```ruby
2437
+ describe network_interface('eni-12ab3cde') do
2438
+ it { should be_attached_to('my-ec2') }
2439
+ it { should be_attached_to('my-ec2').as_eth0 }
2440
+ end
2441
+ ```
2442
+
2443
+
2444
+ ### be_available, be_attaching, be_in_use, be_detaching
2445
+
2446
+ ```ruby
2447
+ describe network_interface('eni-12ab3cde') do
2448
+ it { should be_in_use }
2449
+ end
2450
+ ```
2451
+
2452
+
2453
+ ### have_private_ip_address
2454
+
2455
+ ```ruby
2456
+ describe network_interface('eni-12ab3cde') do
2457
+ it { should have_private_ip_address('10.0.1.1').primary }
2458
+ it { should have_private_ip_address('10.0.1.2') }
2459
+ its(:private_ip_addresses_count) { should eq 2 }
2460
+ end
2461
+ ```
2462
+
2463
+
2464
+ ### have_security_group
2465
+
2466
+ ```ruby
2467
+ describe network_interface('eni-12ab3cde') do
2468
+ it { should have_security_group('my-security-group-name') }
2469
+ end
2470
+ ```
2471
+
2472
+
2473
+ ### have_tag
2474
+
2475
+ ```ruby
2476
+ describe network_interface('eni-12ab3cde') do
2477
+ it { should have_tag('Name').value('my-eni') }
2478
+ end
2479
+ ```
2480
+
2481
+
2482
+ ### belong_to_subnet
2483
+
2484
+ ```ruby
2485
+ describe network_interface('eni-12ab3cde') do
2486
+ it { should belong_to_subnet('my-subnet') }
2487
+ end
2488
+ ```
2489
+
2490
+
2491
+ ### belong_to_vpc
2492
+
2493
+ ```ruby
2494
+ describe network_interface('eni-12ab3cde') do
2495
+ it { should belong_to_vpc('my-vpc') }
2496
+ end
2497
+ ```
2498
+
2499
+ ### its(:association), its(:availability_zone), its(:description), its(:interface_type), its(:ipv_6_addresses), its(:mac_address), its(:network_interface_id), its(:outpost_arn), its(:owner_id), its(:private_dns_name), its(:private_ip_address), its(:requester_id), its(:requester_managed), its(:source_dest_check), its(:status), its(:subnet_id), its(:vpc_id)
2500
+ ## <a name="nlb">nlb</a>
2501
+
2502
+ NLB resource type.
2503
+
2504
+ ### exist
2505
+
2506
+ ```ruby
2507
+ describe nlb('my-nlb') do
2508
+ it { should exist }
2509
+ end
2510
+ ```
2511
+
2512
+
2513
+ ### be_active, be_provisioning, be_failed
2514
+
2515
+ ```ruby
2516
+ describe nlb('my-nlb') do
2517
+ it { should be_active }
2518
+ end
2519
+ ```
2520
+
2521
+
2522
+ ### have_security_group
2523
+
2524
+ Note that NLBs never have security groups. The have_security_group() function always returns false. See https://forums.aws.amazon.com/thread.jspa?threadID=263245 for discussion about the security-group-less-ness of NLBs.
2525
+
2526
+ ```ruby
2527
+ describe nlb('my-nlb') do
2528
+ it { should_not have_security_group('sg-1a2b3cd4') }
2529
+ end
2530
+ ```
2531
+
2532
+
2533
+ ### have_subnet
2534
+
2535
+ ```ruby
2536
+ describe nlb('my-nlb') do
2537
+ it { should have_subnet('subnet-1234a567') }
2538
+ end
2539
+ ```
2540
+
2541
+
2542
+ ### belong_to_vpc
2543
+
2544
+ ```ruby
2545
+ describe nlb('my-nlb') do
2546
+ it { should belong_to_vpc('my-vpc') }
2547
+ end
2548
+ ```
2549
+
2550
+ ### its(:load_balancer_arn), its(:dns_name), its(:canonical_hosted_zone_id), its(:created_time), its(:load_balancer_name), its(:scheme), its(:vpc_id), its(:type), its(:security_groups), its(:ip_address_type)
2551
+ ## <a name="nlb_listener">nlb_listener</a>
2552
+
2553
+ NlbListener resource type.
2554
+
2555
+ ### exist
2556
+
2557
+ ```ruby
2558
+ describe nlb_listener('arn:aws:elasticloadbalancing:ap-northeast-1:1234567890:listener/app/my-nlb/1aa1bb1cc1ddee11/f2f7dc8efc522ab2') do
2559
+ it { should exist }
2560
+ its(:port) { should eq 80 }
2561
+ its(:protocol) { should eq 'HTTP' }
2562
+ end
2563
+ ```
2564
+
2565
+
2566
+ ### have_rule
2567
+
2568
+ ```ruby
2569
+ describe nlb_listener('arn:aws:elasticloadbalancing:ap-northeast-1:1234567890:listener/app/my-nlb/1aa1bb1cc1ddee11/f2f7dc8efc522ab2') do
2570
+ it { should have_rule('arn:aws:elasticloadbalancing:ap-northeast-1:1234567890:listener-rule/app/my-nlb/1aa1bb1cc1ddee11/f2f7dc8efc522ab2/9683b2d02a6cabee') }
2571
+ it do
2572
+ should have_rule.priority('10')
2573
+ .conditions(field: 'path-pattern', values: ['/img/*'])
2574
+ .actions(target_group_arn: 'arn:aws:elasticloadbalancing:ap-northeast-1:1234567890:123456789012:targetgroup/73e2d6bc24d8a067/73e2d6bc24d8a067', type: 'forward')
2575
+ end
2576
+ it do
2577
+ should have_rule.priority('10')
2578
+ .if(field: 'path-pattern', values: ['/img/*'])
2579
+ .then(target_group_arn: 'arn:aws:elasticloadbalancing:ap-northeast-1:1234567890:123456789012:targetgroup/73e2d6bc24d8a067/73e2d6bc24d8a067', type: 'forward')
2580
+ end
2581
+ it { should have_rule.conditions([{ field: 'path-pattern', values: ['/admin/*'] }, { field: 'host-header', values: ['admin.example.com'] }]) }
2582
+ it { should have_rule.actions(target_group_name: 'my-nlb-target-group', type: 'forward') }
2583
+ end
2584
+ ```
2585
+
2586
+ ### its(:listener_arn), its(:load_balancer_arn), its(:port), its(:protocol), its(:certificates), its(:ssl_policy)
2587
+ ## <a name="nlb_target_group">nlb_target_group</a>
2588
+
2589
+ NlbTargetGroup resource type.
2590
+
2591
+ ### exist
2592
+
2593
+ ```ruby
2594
+ describe nlb_target_group('my-nlb-target-group') do
2595
+ it { should exist }
2596
+ its(:health_check_path) { should eq '/' }
2597
+ its(:health_check_port) { should eq 'traffic-port' }
2598
+ its(:health_check_protocol) { should eq 'HTTP' }
2599
+ end
2600
+ ```
2601
+
2602
+
2603
+ ### have_ec2
2604
+
2605
+ ```ruby
2606
+ describe nlb_target_group('my-nlb-target-group') do
2607
+ it { should have_ec2('my-ec2') }
2608
+ end
2609
+ ```
2610
+
2611
+
2612
+ ### belong_to_nlb
2613
+
2614
+ ```ruby
2615
+ describe nlb_target_group('my-nlb-target-group') do
2616
+ it { should belong_to_nlb('my-nlb') }
2617
+ end
2618
+ ```
2619
+
2620
+
2621
+ ### belong_to_vpc
2622
+
2623
+ ```ruby
2624
+ describe nlb_target_group('my-nlb-target-group') do
2625
+ it { should belong_to_vpc('my-vpc') }
2626
+ end
2627
+ ```
2628
+
2629
+
2630
+ ### its(:target_group_arn), its(:target_group_name), its(:protocol), its(:port), its(:vpc_id), its(:health_check_protocol), its(:health_check_port), its(:health_check_enabled), its(:health_check_interval_seconds), its(:health_check_timeout_seconds), its(:healthy_threshold_count), its(:unhealthy_threshold_count), its(:health_check_path), its(:load_balancer_arns), its(:target_type)
2631
+ ## <a name="rds">rds</a>
2632
+
2633
+ RDS resource type.
2634
+
2635
+ ### exist
2636
+
2637
+ ```ruby
2638
+ describe rds('my-rds') do
2639
+ it { should exist }
2640
+ end
2641
+ ```
2642
+
2643
+
2644
+ ### be_available, be_backing_up, be_creating, be_deleting, be_failed, be_inaccessible_encryption_credentials, be_incompatible_credentials, be_incompatible_network, be_incompatible_option_group, be_incompatible_parameters, be_incompatible_restore, be_maintenance, be_modifying, be_rebooting, be_renaming, be_resetting_master_credentials, be_restore_error, be_storage_full, be_upgrading
2645
+
2646
+ ```ruby
2647
+ describe rds('my-rds') do
2648
+ it { should be_available }
2649
+ end
2650
+ ```
2651
+
2652
+
2653
+ ### have_db_parameter_group
2654
+
2655
+ ```ruby
2656
+ describe rds('my-rds') do
2657
+ it { should have_db_parameter_group('my-db-parameter-group') }
2658
+ it do
2659
+ should have_db_parameter_group('custom.mysql5.6')\
2660
+ .parameter_apply_status('in-sync')
2661
+ end
2662
+ end
2663
+ ```
2664
+
2665
+
2666
+ ### have_option_group
2667
+
2668
+ ```ruby
2669
+ describe rds('my-rds') do
2670
+ it { should have_option_group('default:mysql-5-6') }
2671
+ it do
2672
+ should have_option_group('default:mysql-5-6')\
2673
+ .status('in-sync')
2674
+ end
2675
+ end
2676
+ ```
2677
+
2678
+
2679
+ ### have_security_group
2680
+
2681
+ ```ruby
2682
+ describe rds('my-rds') do
2683
+ it { should have_security_group('sg-5a6b7cd8') }
2684
+ it { should have_security_group('my-db-sg') }
2685
+ end
2686
+ ```
2687
+
2688
+
2689
+ ### have_tag
2690
+
2691
+ ```ruby
2692
+ describe rds('my-rds') do
2693
+ it { should have_tag('Name').value('my-rds') }
2694
+ end
2695
+ ```
2696
+
2697
+
2698
+ ### belong_to_db_subnet_group
2699
+
2700
+ ```ruby
2701
+ describe rds('my-rds') do
2702
+ it { should belong_to_db_subnet_group('my-db-subnet-group') }
2703
+ end
2704
+ ```
2705
+
2706
+
2707
+ ### belong_to_subnet
2708
+
2709
+ ```ruby
2710
+ describe rds('my-rds') do
2711
+ it { should belong_to_subnet('subnet-8901b123') }
2712
+ it { should belong_to_subnet('db-subnet-a') }
2713
+ end
2714
+ ```
2715
+
2716
+
2717
+ ### belong_to_vpc
2718
+
2719
+ ```ruby
2720
+ describe rds('my-rds') do
2721
+ it { should belong_to_vpc('vpc-ab123cde') }
2722
+ it { should belong_to_vpc('my-vpc') }
2723
+ end
2724
+ ```
2725
+
2726
+
2727
+ ### its(:vpc_id), its(:db_instance_identifier), its(:db_instance_class), its(:engine), its(:db_instance_status), its(:master_username), its(:db_name), its(:endpoint), its(:allocated_storage), its(:instance_create_time), its(:preferred_backup_window), its(:backup_retention_period), its(:db_security_groups), its(:availability_zone), its(:preferred_maintenance_window), its(:pending_modified_values), its(:latest_restorable_time), its(:multi_az), its(:engine_version), its(:auto_minor_version_upgrade), its(:read_replica_source_db_instance_identifier), its(:read_replica_db_instance_identifiers), its(:read_replica_db_cluster_identifiers), its(:license_model), its(:iops), its(:character_set_name), its(:secondary_availability_zone), its(:publicly_accessible), its(:status_infos), its(:storage_type), its(:tde_credential_arn), its(:db_instance_port), its(:db_cluster_identifier), its(:storage_encrypted), its(:kms_key_id), its(:dbi_resource_id), its(:ca_certificate_identifier), its(:domain_memberships), its(:copy_tags_to_snapshot), its(:monitoring_interval), its(:enhanced_monitoring_resource_arn), its(:monitoring_role_arn), its(:promotion_tier), its(:db_instance_arn), its(:timezone), its(:iam_database_authentication_enabled), its(:performance_insights_enabled), its(:performance_insights_kms_key_id), its(:performance_insights_retention_period), its(:enabled_cloudwatch_logs_exports), its(:processor_features), its(:deletion_protection), its(:associated_roles), its(:listener_endpoint), its(:max_allocated_storage)
2728
+ ### :unlock: Advanced use
2729
+
2730
+ `rds` can use `Aws::RDS::DBInstance` resource (see http://docs.aws.amazon.com/sdkforruby/api/Aws/RDS/DBInstance.html).
2731
+
2732
+ ```ruby
2733
+ describe rds('my-rds') do
2734
+ its('db_subnet_group.db_subnet_group_name') { should eq 'my-db-subnet-group' }
2735
+ end
2736
+ ```
2737
+
2738
+ or
2739
+
2740
+ ```ruby
2741
+ describe rds('my-rds') do
2742
+ its('resource.db_subnet_group.db_subnet_group_name') { should eq 'my-db-subnet-group' }
2743
+ end
2744
+ ```
2745
+
2746
+ ## <a name="rds_db_cluster_parameter_group">rds_db_cluster_parameter_group</a>
2747
+
2748
+ RdsDbClusterParameterGroup resource type.
2749
+
2750
+ ```ruby
2751
+ describe rds_db_cluster_parameter_group('my-rds-db-cluster-parameter-group') do
2752
+ its(:time_zone) { should eq 'US/Central' }
2753
+ its(:binlog_format) { should eq 'ROW' }
2754
+ its(:character_set_server) { should eq 'utf8mb4' }
2755
+ end
2756
+ ```
2757
+
2758
+ ### exist
2759
+
2760
+ ```ruby
2761
+ describe rds_db_cluster_parameter_group('my-rds-db-cluster-parameter-group') do
2762
+ it { should exist }
2763
+ end
2764
+ ```
2765
+
2766
+
2767
+ ## <a name="rds_db_parameter_group">rds_db_parameter_group</a>
2768
+
2769
+ RdsDbParameterGroup resource type.
2770
+
2771
+ ```ruby
2772
+ describe rds_db_parameter_group('my-rds-db-parameter-group') do
2773
+ its(:basedir) { should eq '/rdsdbbin/mysql' }
2774
+ its(:innodb_buffer_pool_size) { '{DBInstanceClassMemory*3/4}' }
2775
+ end
2776
+ ```
2777
+
2778
+ ### exist
2779
+
2780
+ ```ruby
2781
+ describe rds_db_parameter_group('my-rds-db-parameter-group') do
2782
+ it { should exist }
2783
+ end
2784
+ ```
2785
+
2786
+
2787
+ ## <a name="redshift">redshift</a>
2788
+
2789
+ Redshift resource type.
2790
+
2791
+ ### exist
2792
+
2793
+ ```ruby
2794
+ describe redshift('my-redshift') do
2795
+ it { should exist }
2796
+ end
2797
+ ```
2798
+
2799
+
2800
+ ### be_available, be_cancelling_resize, be_creating, be_deleting, be_final_snapshot, be_hardware_failure, be_incompatible_hsm, be_incompatible_network, be_incompatible_parameters, be_incompatible_restore, be_modifying, be_rebooting, be_renaming, be_resizing, be_rotating_keys, be_storage_full, be_updating_hsm
2801
+
2802
+ ```ruby
2803
+ describe redshift('my-redshift') do
2804
+ it { should be_available }
2805
+ end
2806
+ ```
2807
+
2808
+
2809
+ ### have_cluster_parameter_group
2810
+
2811
+ ```ruby
2812
+ describe redshift('my-redshift') do
2813
+ it { should have_cluster_parameter_group('my-pg') }
2814
+ it do
2815
+ should have_cluster_parameter_group('my-pg')\
2816
+ .parameter_apply_status('in-sync')
2817
+ end
2818
+ end
2819
+ ```
2820
+
2821
+
2822
+ ### have_security_group
2823
+
2824
+ ```ruby
2825
+ describe redshift('my-redshift') do
2826
+ it { should have_security_group('sg-1a2b3c4d') }
2827
+ it { should have_security_group('group-name-sg') }
2828
+ end
2829
+ ```
2830
+
2831
+
2832
+ ### have_tag
2833
+
2834
+ ```ruby
2835
+ describe redshift('my-redshift') do
2836
+ it { should have_tag('Name').value('my-cluster') }
2837
+ end
2838
+ ```
2839
+
2840
+
2841
+ ### belong_to_cluster_subnet_group
2842
+
2843
+ ```ruby
2844
+ describe redshift('my-redshift') do
2845
+ it { should belong_to_cluster_subnet_group('my-sg') }
2846
+ end
2847
+ ```
2848
+
2849
+
2850
+ ### belong_to_vpc
2851
+
2852
+ ```ruby
2853
+ describe redshift('my-redshift') do
2854
+ it { should belong_to_vpc('vpc-ab123cde') }
2855
+ it { should belong_to_vpc('my-vpc') }
2856
+ end
2857
+ ```
2858
+
2859
+ ### its(:vpc_id), its(:cluster_identifier), its(:node_type), its(:cluster_status), its(:cluster_availability_status), its(:modify_status), its(:master_username), its(:db_name), its(:endpoint), its(:cluster_create_time), its(:automated_snapshot_retention_period), its(:manual_snapshot_retention_period), its(:cluster_security_groups), its(:cluster_subnet_group_name), its(:vpc_id), its(:availability_zone), its(:preferred_maintenance_window), its(:pending_modified_values), its(:cluster_version), its(:allow_version_upgrade), its(:number_of_nodes), its(:publicly_accessible), its(:encrypted), its(:restore_status), its(:data_transfer_progress), its(:hsm_status), its(:cluster_snapshot_copy_status), its(:cluster_public_key), its(:cluster_nodes), its(:elastic_ip_status), its(:cluster_revision_number), its(:kms_key_id), its(:enhanced_vpc_routing), its(:iam_roles), its(:pending_actions), its(:maintenance_track_name), its(:elastic_resize_number_of_node_options), its(:deferred_maintenance_windows), its(:snapshot_schedule_identifier), its(:snapshot_schedule_state), its(:expected_next_snapshot_schedule_time), its(:expected_next_snapshot_schedule_time_status), its(:next_maintenance_window_start_time), its(:resize_info)
2860
+ ## <a name="redshift_cluster_parameter_group">redshift_cluster_parameter_group</a>
2861
+
2862
+ RedshiftClusterParameterGroup resource type.
2863
+
2864
+ ```ruby
2865
+ describe redshift_cluster_parameter_group('my-redshift-cluster-parameter-group') do
2866
+ its(:datestyle) { should eq 'ISO, MDY' }
2867
+ its(:query_group) { should eq 'default' }
2868
+ its(:require_ssl) { should eq 'false' }
2869
+ end
2870
+ ```
2871
+
2872
+
2873
+ ### exist
2874
+
2875
+ ```ruby
2876
+ describe redshift_cluster_parameter_group('my-redshift-cluster-parameter-group') do
2877
+ it { should exist }
2878
+ end
2879
+ ```
2880
+
2881
+
2882
+ ## <a name="route53_hosted_zone">route53_hosted_zone</a>
2883
+
2884
+ Route53HostedZone resource type.
2885
+
2886
+ ### exist
2887
+
2888
+ ```ruby
2889
+ describe route53_hosted_zone('example.com.') do
2890
+ it { should exist }
2891
+ end
2892
+ ```
2893
+
2894
+
2895
+ ### have_record_set
2896
+
2897
+ ```ruby
2898
+ describe route53_hosted_zone('example.com.') do
2899
+ its(:resource_record_set_count) { should eq 6 }
2900
+ it { should have_record_set('example.com.') }
2901
+ it { should have_record_set('example.com.').type('a') }
2902
+ it { should have_record_set('example.com.').a('123.456.7.890') }
2903
+ it { should have_record_set('*.example.com.').cname('example.com') }
2904
+ it { should have_record_set('example.com.').mx('10 mail.example.com') }
2905
+ it { should have_record_set('mail.example.com.').a('123.456.7.890').ttl(3600) }
2906
+ ns = 'ns-123.awsdns-45.net.
2907
+ ns-6789.awsdns-01.org.
2908
+ ns-2345.awsdns-67.co.uk.
2909
+ ns-890.awsdns-12.com.'
2910
+ it { should have_record_set('example.com.').ns(ns) }
2911
+ it { should have_record_set('s3.example.com.').alias('s3-website-us-east-1.amazonaws.com.', 'Z2ABCDEFGHIJKL') }
2912
+ end
2913
+ ```
2914
+
2915
+ ### its(:id), its(:name), its(:caller_reference), its(:config), its(:resource_record_set_count), its(:linked_service)
2916
+ ## <a name="route_table">route_table</a>
2917
+
2918
+ RouteTable resource type.
2919
+
2920
+ ### exist
2921
+
2922
+ ```ruby
2923
+ describe route_table('my-route-table') do
2924
+ it { should exist }
2925
+ end
2926
+ ```
2927
+
2928
+
2929
+ ### have_route
2930
+
2931
+ ```ruby
2932
+ describe route_table('my-route-table') do
2933
+ it { should have_route('10.0.0.0/16').target(gateway: 'local') }
2934
+ it { should have_route('0.0.0.0/0').target(gateway: 'igw-1ab2345c') }
2935
+ it { should have_route('192.168.1.0/24').target(instance: 'my-ec2') }
2936
+ it { should have_route('192.168.2.0/24').target(vpc_peering_connection: 'my-pcx') }
2937
+ it { should have_route('192.168.3.0/24').target(nat: 'nat-7ff7777f') }
2938
+ end
2939
+ ```
2940
+
2941
+
2942
+ ### have_subnet
2943
+
2944
+ ```ruby
2945
+ describe route_table('my-route-table') do
2946
+ it { should have_subnet('my-subnet') }
2947
+ end
2948
+ ```
2949
+
2950
+
2951
+ ### have_tag
2952
+
2953
+ ```ruby
2954
+ describe route_table('my-route-table') do
2955
+ it { should have_tag('Name').value('my-route-table') }
2956
+ end
2957
+ ```
2958
+
2959
+
2960
+ ### its(:propagating_vgws), its(:route_table_id), its(:vpc_id), its(:owner_id)
2961
+ ### :unlock: Advanced use
2962
+
2963
+ `route_table` can use `Aws::EC2::RouteTable` resource (see http://docs.aws.amazon.com/sdkforruby/api/Aws/EC2/RouteTable.html).
2964
+
2965
+ ```ruby
2966
+ describe route_table('my-route-table') do
2967
+ its('vpc.id') { should eq 'vpc-ab123cde' }
2968
+ end
2969
+ ```
2970
+
2971
+ or
2972
+
2973
+ ```ruby
2974
+ describe s3_bucket('my-bucket') do
2975
+ its('resource.vpc.id') { should eq 'vpc-ab123cde' }
2976
+ end
2977
+ ```
2978
+
2979
+ ## <a name="s3_bucket">s3_bucket</a>
2980
+
2981
+ S3Bucket resource type.
2982
+
2983
+ ### exist
2984
+
2985
+ ```ruby
2986
+ describe s3_bucket('my-bucket') do
2987
+ it { should exist }
2988
+ end
2989
+ ```
2990
+
2991
+
2992
+ ### have_acl_grant
2993
+
2994
+ ```ruby
2995
+ describe s3_bucket('my-bucket') do
2996
+ its(:acl_owner) { should eq 'my-bucket-owner' }
2997
+ its(:acl_grants_count) { should eq 3 }
2998
+ it { should have_acl_grant(grantee: 'my-bucket-owner', permission: 'FULL_CONTROL') }
2999
+ it { should have_acl_grant(grantee: 'http://acs.amazonaws.com/groups/s3/LogDelivery', permission: 'WRITE') }
3000
+ it { should have_acl_grant(grantee: '68f4bb06b094152df53893bfba57760e', permission: 'READ') }
3001
+ end
3002
+ ```
3003
+
3004
+
3005
+ ### have_cors_rule
3006
+
3007
+ ```ruby
3008
+ describe s3_bucket('my-bucket') do
3009
+ it do
3010
+ should have_cors_rule(
3011
+ allowed_methods: ['GET'],
3012
+ allowed_origins: ['*']
3013
+ )
3014
+ end
3015
+ it do
3016
+ should have_cors_rule(
3017
+ allowed_headers: ['*'],
3018
+ allowed_methods: ['GET'],
3019
+ allowed_origins: ['https://example.org', 'https://example.com'],
3020
+ expose_headers: ['X-Custom-Header'],
3021
+ max_age_seconds: 3600
3022
+ )
3023
+ end
3024
+ end
3025
+ ```
3026
+
3027
+
3028
+ ### have_lifecycle_rule
3029
+
3030
+ ```ruby
3031
+ describe s3_bucket('my-bucket') do
3032
+ it do
3033
+ should have_lifecycle_rule(
3034
+ id: 'MyRuleName',
3035
+ noncurrent_version_expiration: { noncurrent_days: 1 },
3036
+ expiration: { days: 2 },
3037
+ transitions: [{ days: 3, storage_class: 'GLACIER' }],
3038
+ status: 'Enabled'
3039
+ )
3040
+ end
3041
+
3042
+ it do
3043
+ should have_lifecycle_rule(
3044
+ id: 'MyRuleName2',
3045
+ prefix: '123/',
3046
+ noncurrent_version_expiration: { noncurrent_days: 2 },
3047
+ expiration: { days: 3 },
3048
+ transitions: [{ days: 5, storage_class: 'STANDARD_IA' }, { days: 10, storage_class: 'GLACIER' }],
3049
+ status: 'Enabled'
3050
+ )
3051
+ end
3052
+ end
3053
+ ```
3054
+
3055
+
3056
+ ### have_logging_enabled
3057
+
3058
+ ```ruby
3059
+ describe s3_bucket('my-bucket') do
3060
+ it { should have_logging_enabled(target_bucket: 'my-log-bucket', target_prefix: 'logs/') }
3061
+ end
3062
+ ```
3063
+
3064
+
3065
+ ### have_mfa_delete_enabled
3066
+
3067
+ ```ruby
3068
+ describe s3_bucket('my-bucket') do
3069
+ it { should have_mfa_delete_enabled }
3070
+ end
3071
+ ```
3072
+
3073
+
3074
+ ### have_object
3075
+
3076
+ ```ruby
3077
+ describe s3_bucket('my-bucket') do
3078
+ it { should have_object('path/to/object') }
3079
+ end
3080
+ ```
3081
+
3082
+
3083
+ ### have_policy
3084
+
3085
+ ```ruby
3086
+ describe s3_bucket('my-bucket') do
3087
+ it do
3088
+ should have_policy <<-POLICY
3089
+ {
3090
+ "Version": "2012-10-17",
3091
+ "Statement": [
3092
+ {
3093
+ "Sid": "AllowPublicRead",
3094
+ "Effect": "Allow",
3095
+ "Principal": "*",
3096
+ "Action": "s3:GetObject",
3097
+ "Resource": "arn:aws:s3:::my-bucket/*"
3098
+ }
3099
+ ]
3100
+ }
3101
+ POLICY
3102
+ end
3103
+ end
3104
+ ```
3105
+
3106
+
3107
+ ### have_server_side_encryption
3108
+
3109
+ ```
3110
+ describe s3_bucket('my-bucket') do
3111
+ it { should have_server_side_encryption(algorithm: "AES256") }
3112
+ it { should have_server_side_encryption(algorithm: "aws:kms") }
3113
+ end
3114
+ ```
3115
+
3116
+
3117
+ ### have_tag
3118
+
3119
+ ```ruby
3120
+ describe s3_bucket('my-bucket') do
3121
+ it { should have_tag('env').value('dev') }
3122
+ end
3123
+ ```
3124
+
3125
+
3126
+ ### have_versioning_enabled
3127
+
3128
+ ```ruby
3129
+ describe s3_bucket('my-bucket') do
3130
+ it { should have_versioning_enabled }
3131
+ end
3132
+ ```
3133
+
3134
+
3135
+ ### its(:acl_grants_count), its(:acl_owner), its(:cors_rules_count), its(:name), its(:creation_date)
3136
+ ### :unlock: Advanced use
3137
+
3138
+ `s3_bucket` can use `Aws::S3::Bucket` resource (see http://docs.aws.amazon.com/sdkforruby/api/Aws/S3/Bucket.html).
3139
+
3140
+ ```ruby
3141
+ describe s3_bucket('my-bucket') do
3142
+ its('acl.owner.display_name') { should eq 'my-bucket-owner' }
3143
+ end
3144
+ ```
3145
+
3146
+ or
3147
+
3148
+ ```ruby
3149
+ describe s3_bucket('my-bucket') do
3150
+ its('resource.acl.owner.display_name') { should eq 'my-bucket-owner' }
3151
+ end
3152
+ ```
3153
+
3154
+ ## <a name="secretsmanager">secretsmanager</a>
3155
+
3156
+ Secretsmanager resource type.
3157
+
3158
+ ### exist
3159
+
3160
+ ```ruby
3161
+ describe secretsmanager('my-secret') do
3162
+ it { should exist }
3163
+ end
3164
+ ```
3165
+
3166
+
3167
+ ### have_tag
3168
+
3169
+ ```ruby
3170
+ describe secretsmanager('my-secret') do
3171
+ it { should have_tag('Name').value('my-secret') }
3172
+ end
3173
+ ```
3174
+
3175
+ ### its(:arn), its(:name), its(:description), its(:kms_key_id), its(:rotation_enabled), its(:rotation_lambda_arn), its(:last_rotated_date), its(:last_changed_date), its(:last_accessed_date), its(:deleted_date), its(:owning_service)
3176
+ ## <a name="security_group">security_group</a>
3177
+
3178
+ SecurityGroup resource type.
3179
+
3180
+ ### exist
3181
+
3182
+ ```ruby
3183
+ describe security_group('my-security-group-name') do
3184
+ it { should exist }
3185
+ end
3186
+ ```
3187
+
3188
+
3189
+ ### be_inbound_opened_only
3190
+
3191
+ ### be_opened_only
3192
+
3193
+ ### be_outbound_opened_only
3194
+
3195
+ ### have_tag
3196
+
3197
+ ```ruby
3198
+ describe security_group('my-security-group-name') do
3199
+ it { should have_tag('env').value('dev') }
3200
+ end
3201
+ ```
3202
+
3203
+
3204
+ ### its(:inbound), its(:outbound)
3205
+
3206
+ ```ruby
3207
+ describe security_group('my-security-group-name') do
3208
+ its(:outbound) { should be_opened }
3209
+ its(:inbound) { should be_opened(80) }
3210
+ its(:inbound) { should be_opened(80).protocol('tcp').for('203.0.113.1/32') }
3211
+ its(:inbound) { should be_opened(22).protocol('tcp').for('sg-5a6b7cd8') }
3212
+ end
3213
+ ```
3214
+
3215
+
3216
+ ### its(:inbound_rule_count), its(:outbound_rule_count), its(:inbound_permissions_count), its(:outbound_permissions_count), its(:description), its(:group_name), its(:owner_id), its(:group_id), its(:vpc_id)
3217
+ ### :unlock: Advanced use
3218
+
3219
+ `security_group` can use `Aws::EC2::SecurityGroup` resource (see http://docs.aws.amazon.com/sdkforruby/api/Aws/EC2/SecurityGroup.html).
3220
+
3221
+ ```ruby
3222
+ describe security_group('my-security-group-name') do
3223
+ its('group_name') { should eq 'my-security-group-name' }
3224
+ end
3225
+ ```
3226
+
3227
+ or
3228
+
3229
+ ```ruby
3230
+ describe security_group('my-security-group-name') do
3231
+ its('resource.group_name') { should eq 'my-security-group-name' }
3232
+ end
3233
+ ```
3234
+
3235
+ ## <a name="ses_identity">ses_identity</a>
3236
+
3237
+ SesIdentity resource type.
3238
+
3239
+ ### exist
3240
+
3241
+ ```ruby
3242
+ describe ses_identity('example.com') do
3243
+ it { should exist }
3244
+ end
3245
+ ```
3246
+
3247
+
3248
+ ### have_dkim_tokens
3249
+
3250
+
3251
+ ### have_identity_policy
3252
+
3253
+ ```ruby
3254
+ describe ses_identity('example.com') do
3255
+ it { should have_identity_policy('my-identity-policy-name') }
3256
+ end
3257
+ ```
3258
+
3259
+ ### its(:dkim_enabled), its(:dkim_verification_status), its(:bounce_topic), its(:complaint_topic), its(:delivery_topic), its(:forwarding_enabled), its(:verification_status), its(:verification_token)
3260
+ ## <a name="sns_topic">sns_topic</a>
3261
+
3262
+ SnsTopic resource type.
3263
+
3264
+ ### exist
3265
+
3266
+ ```ruby
3267
+ describe sns_topic(topic_arn) do
3268
+ it { should exist }
3269
+ end
3270
+ ```
3271
+
3272
+
3273
+ ### have_subscription
3274
+
3275
+ ```ruby
3276
+ describe sns_topic(topic_arn) do
3277
+ let(:subscription_arn) do
3278
+ subscription_arn: subscribed, # this is required
3279
+ end
3280
+
3281
+ describe '#subscribed' do
3282
+ it do
3283
+ should have_subscription(subscribed)
3284
+ end
3285
+ end
3286
+ end
3287
+ ```
3288
+
3289
+ An [automatic matcher](https://www.rubydoc.info/github/rspec/rspec-expectations/RSpec/Matchers) created due the predicate `has_subscription?` existing method of `Awspec::Type::SnsTopic` class.
3290
+
3291
+ It validates if a given AWS SNS ARN subscription exists in the SNS Topic.
3292
+
3293
+
3294
+ ### have_subscription_attributes
3295
+
3296
+ ```ruby
3297
+ describe sns_topic(topic_arn) do
3298
+ let(:expected_attribs) do
3299
+ { protocol: 'lambda',
3300
+ owner: '123456789',
3301
+ subscription_arn: subscribed, # this is required
3302
+ endpoint: 'arn:aws:lambda:us-east-1:123456789:function:foobar' }
3303
+ end
3304
+
3305
+ describe '#subscribed' do
3306
+ it do
3307
+ should have_subscription_attributes(expected_attribs)
3308
+ end
3309
+ end
3310
+ end
3311
+ ```
3312
+
3313
+ Where `:expected_attribs` is a hash with keys as properties that are part of a SNS Topic subscription:
3314
+
3315
+ * subscription_arn
3316
+ * owner
3317
+ * protocol
3318
+ * endpoint
3319
+ * topic_arn
3320
+
3321
+ You can use any combinations of key/values that will be used by `have_subscription_attributes`, but the `subscription_arn` is required and if it is missing, an exception will be generated.
3322
+
3323
+
3324
+ ### include_subscribed
3325
+
3326
+ ```ruby
3327
+ describe sns_topic(topic_arn) do
3328
+ it { should include_subscribed(subscribed) }
3329
+ end
3330
+ ```
3331
+
3332
+
3333
+ ### its(:policy), its(:owner), its(:pending_subscriptions), its(:topic_arn), its(:effective_delivery_policy), its(:display_name), its(:confirmed_subscriptions), its(:deleted_subscriptions), its(:name)
3334
+ ### :unlock: Advanced use
3335
+
3336
+ You may want to validate the subscriptions too. For that, you probably will want to use the methods `subscriptions` (that will return a list of the subscriptions ARN as symbols) and `has_subscription?` (that expects a SNS Topic subscription as parameter and will return `true` of `false` if it exists as a subscription) of the class `Awspec::Type::SnsTopic` to build the fixture in order to use the matcher `have_subscription_attributes`.
3337
+
3338
+ ## <a name="sqs">sqs</a>
3339
+
3340
+ SQS resource type.
3341
+
3342
+ ### exist
3343
+
3344
+ ```ruby
3345
+ describe sqs('my-queue') do
3346
+ it { should exist }
3347
+ end
3348
+ ```
3349
+
3350
+ ### have_tag
3351
+
3352
+ ### its(:queue_arn), its(:approximate_number_of_messages), its(:approximate_number_of_messages_not_visible), its(:approximate_number_of_messages_delayed), its(:created_timestamp), its(:last_modified_timestamp), its(:visibility_timeout), its(:maximum_message_size), its(:message_retention_period), its(:delay_seconds), its(:receive_message_wait_time_seconds), its(:queue_url)
3353
+ ## <a name="ssm_parameter">ssm_parameter</a>
3354
+
3355
+ SsmParameter resource type.
3356
+
3357
+ ### exist
3358
+
3359
+ ```ruby
3360
+ describe ssm_parameter('my-parameter') do
3361
+ it { should exist }
3362
+ end
3363
+ ```
3364
+
3365
+
3366
+ ### be_encrypted
3367
+
3368
+ ```ruby
3369
+ describe ssm_parameter('my-parameter') do
3370
+ it { should be_encrypted }
3371
+ end
3372
+ ```
3373
+
3374
+
3375
+ ### have_tag
3376
+
3377
+ ```ruby
3378
+ describe ssm_parameter('my-parameter') do
3379
+ it { should have_tag('my-key').value('my-value') }
3380
+ end
3381
+ ```
3382
+
3383
+
3384
+ ### its(:name), its(:type), its(:key_id), its(:last_modified_date), its(:last_modified_user), its(:description), its(:allowed_pattern), its(:version), its(:tier), its(:policies)
3385
+ ### :unlock: Advanced use
3386
+
3387
+ ```ruby
3388
+ describe ssm_parameter('my-parameter') do
3389
+ its(:key_id) { should be_eql('6a81f446-27b0-4d51-a04f-af7ddeea2e22') }
3390
+ its(:description) { should be_eql('Some string description') }
3391
+ its(:version) { should be_eql(1) }
3392
+ end
3393
+ ```
3394
+
3395
+ ## <a name="subnet">subnet</a>
3396
+
3397
+ Subnet resource type.
3398
+
3399
+ ### exist
3400
+
3401
+ ```ruby
3402
+ describe subnet('my-subnet') do
3403
+ it { should exist }
3404
+ end
3405
+ ```
3406
+
3407
+
3408
+ ### be_associated_to
3409
+
3410
+ ### be_available, be_pending
3411
+
3412
+ ```ruby
3413
+ describe subnet('my-subnet') do
3414
+ it { should be_available }
3415
+ end
3416
+ ```
3417
+
3418
+
3419
+ ### have_tag
3420
+
3421
+ ```ruby
3422
+ describe subnet('my-subnet') do
3423
+ it { should have_tag('Environment').value('QA') }
3424
+ end
3425
+ ```
3426
+
3427
+
3428
+ ### its(:availability_zone), its(:availability_zone_id), its(:available_ip_address_count), its(:cidr_block), its(:default_for_az), its(:map_public_ip_on_launch), its(:state), its(:subnet_id), its(:vpc_id), its(:owner_id), its(:assign_ipv_6_address_on_creation), its(:ipv_6_cidr_block_association_set), its(:subnet_arn), its(:outpost_arn)
3429
+ ### :unlock: Advanced use
3430
+
3431
+ `subnet` can use `Aws::EC2::Subnet` resource (see http://docs.aws.amazon.com/sdkforruby/api/Aws/EC2/Subnet.html).
3432
+
3433
+ ```ruby
3434
+ describe subnet('my-subnet') do
3435
+ its('vpc.id') { should eq 'vpc-ab123cde' }
3436
+ end
3437
+ ```
3438
+
3439
+ or
3440
+
3441
+ ```ruby
3442
+ describe subnet('my-subnet') do
3443
+ its('resource.vpc.id') { should eq 'vpc-ab123cde' }
3444
+ end
3445
+ ```
3446
+
3447
+ ## <a name="vpc">vpc</a>
3448
+
3449
+ VPC resource type.
3450
+
3451
+ ### exist
3452
+
3453
+ ```ruby
3454
+ describe vpc('my-vpc') do
3455
+ it { should exist }
3456
+ end
3457
+ ```
3458
+
3459
+
3460
+ ### be_available, be_pending
3461
+
3462
+ ```ruby
3463
+ describe vpc('vpc-ab123cde') do
3464
+ it { should be_available }
3465
+ end
3466
+ ```
3467
+
3468
+
3469
+ ### be_connected_to_vpc
3470
+
3471
+ ```ruby
3472
+ describe vpc('vpc-ab123cde') do
3473
+ it { should be_connected_to_vpc('vpc-bcd1235e') }
3474
+ it { should be_connected_to_vpc('vpc-bcd1235e').as_accepter }
3475
+ it { should_not be_connected_to_vpc('vpc-bcd1235e').as_requester }
3476
+ end
3477
+ ```
3478
+
3479
+
3480
+ ### have_network_acl
3481
+
3482
+ ```ruby
3483
+ describe vpc('vpc-ab123cde') do
3484
+ it { should have_network_acl('acl-1abc2d3e') }
3485
+ it { should have_network_acl('my-network-acl') }
3486
+ end
3487
+ ```
3488
+
3489
+
3490
+ ### have_route_table
3491
+
3492
+ ```ruby
3493
+ describe vpc('vpc-ab123cde') do
3494
+ it { should have_route_table('rtb-ab123cde') }
3495
+ it { should have_route_table('my-route-table') }
3496
+ end
3497
+ ```
3498
+
3499
+
3500
+ ### have_tag
3501
+
3502
+ ```ruby
3503
+ describe vpc('vpc-ab123cde') do
3504
+ it { should have_tag('Stack').value('Networking') }
3505
+ end
3506
+ ```
3507
+
3508
+
3509
+ ### have_vpc_attribute
3510
+
3511
+ ```ruby
3512
+ describe vpc('vpc-ab123cde') do
3513
+ it { should have_vpc_attribute('enableDnsHostnames') }
3514
+ it { should_not have_vpc_attribute('enableDnsSupport') }
3515
+ end
3516
+ ```
3517
+
3518
+
3519
+ ### have_vpc_peering_connection
3520
+
3521
+ ```ruby
3522
+ describe vpc('vpc-ab123cde') do
3523
+ it { should have_vpc_peering_connection('pcx-c56789de') }
3524
+ it { should have_vpc_peering_connection('pcx-c56789de').as_accepter }
3525
+ it { should_not have_vpc_peering_connection('pcx-c56789de').as_requester }
3526
+ end
3527
+ ```
3528
+
3529
+
3530
+ ### its(:cidr_block), its(:dhcp_options_id), its(:state), its(:vpc_id), its(:owner_id), its(:instance_tenancy), its(:ipv_6_cidr_block_association_set), its(:cidr_block_association_set), its(:is_default)
3531
+ ### :unlock: Advanced use
3532
+
3533
+ `vpc` can use `Aws::EC2::Vpc` resource (see http://docs.aws.amazon.com/sdkforruby/api/Aws/EC2/Vpc.html).
3534
+
3535
+ ```ruby
3536
+ describe vpc('my-vpc') do
3537
+ its('route_tables.first.route_table_id') { should eq 'rtb-a12bcd34' }
3538
+ end
3539
+ ```
3540
+
3541
+ or
3542
+
3543
+ ```ruby
3544
+ describe vpc('my-vpc') do
3545
+ its('resource.route_tables.first.route_table_id') { should eq 'rtb-a12bcd34' }
3546
+ end
3547
+ ```
3548
+
3549
+ ## <a name="vpn_connection">vpn_connection</a>
3550
+
3551
+ VpnConnection resource type.
3552
+
3553
+ ### exist
3554
+
3555
+ ```ruby
3556
+ describe vpn_connection('my-vpn-connection') do
3557
+ it { should exist }
3558
+ end
3559
+ ```
3560
+
3561
+
3562
+ ### be_pending, be_available, be_deleting, be_deleted
3563
+
3564
+ ```ruby
3565
+ describe vpn_connection('my-vpn-connection') do
3566
+ it { should be_running }
3567
+ end
3568
+ ```
3569
+
3570
+
3571
+ ### have_tag
3572
+
3573
+ ```ruby
3574
+ describe vpn_connection('my-vpn-connection') do
3575
+ it { should have_tag('Name').value('my-vpn-connection') }
3576
+ end
3577
+ ```
3578
+
3579
+
3580
+ ### its(:customer_gateway_configuration), its(:customer_gateway_id), its(:category), its(:state), its(:type), its(:vpn_connection_id), its(:vpn_gateway_id), its(:transit_gateway_id), its(:options), its(:routes), its(:vgw_telemetry)
3581
+ ## <a name="vpn_gateway">vpn_gateway</a>
3582
+
3583
+ VpnGateway resource type.
3584
+
3585
+ ### exist
3586
+
3587
+ ```ruby
3588
+ describe vpn_gateway('my-vpn-gateway') do
3589
+ it { should exist }
3590
+ end
3591
+ ```
3592
+
3593
+
3594
+ ### be_pending, be_available, be_deleting, be_deleted
3595
+
3596
+ ```ruby
3597
+ describe vpn_gateway('my-vpn-gateway') do
3598
+ it { should be_running }
3599
+ end
3600
+ ```
3601
+
3602
+
3603
+ ### have_tag
3604
+
3605
+ ```ruby
3606
+ describe vpn_gateway('my-vpn-gateway') do
3607
+ it { should have_tag('Name').value('my-vpn-gateway') }
3608
+ end
3609
+ ```
3610
+
3611
+
3612
+ ### its(:availability_zone), its(:state), its(:type), its(:vpc_attachments), its(:vpn_gateway_id), its(:amazon_side_asn), its(:tags)
3613
+ ## <a name="waf_web_acl">waf_web_acl</a>
3614
+
3615
+ WafWebAcl resource type.
3616
+
3617
+ ### exist
3618
+
3619
+ ```ruby
3620
+ describe waf_web_acl('my-waf-web-acl') do
3621
+ it { should exist }
3622
+ its(:default_action) { should eq 'BLOCK' }
3623
+ it { should have_rule('my-waf-web-acl-allowed-ips') }
3624
+ it { should have_rule('my-waf-web-acl-allowed-ips').order(2).action('BLOCK') }
3625
+ end
3626
+ ```
3627
+
3628
+
3629
+ ### have_rule
3630
+
3631
+ ```ruby
3632
+ describe waf_web_acl('my-waf-web-acl') do
3633
+ it { should have_rule('my-waf-web-acl-allowed-ips') }
3634
+ it { should have_rule('my-waf-web-acl-allowed-ips').order(2).action('BLOCK') }
3635
+ end
3636
+ ```
3637
+
3638
+
3639
+ ### its(:default_action), its(:web_acl_id), its(:name), its(:metric_name), its(:web_acl_arn)
3640
+ ## <a name="wafregional_web_acl">wafregional_web_acl</a>
3641
+
3642
+ WafregionalWebAcl resource type.
3643
+
3644
+ ### exist
3645
+
3646
+ ```ruby
3647
+ describe wafregional_web_acl('my-wafregional-web-acl') do
3648
+ it { should exist }
3649
+ its(:default_action) { should eq 'BLOCK' }
3650
+ it { should have_rule('my-wafregional-web-acl-allowed-ips') }
3651
+ it { should have_rule('my-wafregional-web-acl-allowed-ips').order(2).action('BLOCK') }
3652
+ end
3653
+ ```
3654
+
3655
+
3656
+ ### have_rule
3657
+
3658
+ ```ruby
3659
+ describe wafregional_web_acl('my-wafregional-web-acl') do
3660
+ it { should have_rule('my-wafregional-web-acl-allowed-ips') }
3661
+ it { should have_rule('my-wafregional-web-acl-allowed-ips').order(2).action('BLOCK') }
3662
+ end
3663
+ ```
3664
+
3665
+
3666
+ ### its(:default_action), its(:web_acl_id), its(:name), its(:metric_name), its(:web_acl_arn)
3667
+ # Account and Attributes
3668
+
3669
+ ## <a name="account">account</a>
3670
+
3671
+ Account resource type.
3672
+
3673
+ ```ruby
3674
+ describe account do
3675
+ its(:user_id) { should eq 'AKIAI44QH8DHBEXAMPLE' }
3676
+ its(:account) { should eq '123456789012' }
3677
+ its(:arn) { should eq 'arn:aws:iam::123456789012:user/Alice' }
3678
+ its('ec2.supported_platforms') { should eq ["EC2", "VPC"] }
3679
+ its('ec2.vpc_max_security_groups_per_interface') { should eq 5 }
3680
+ its('ec2.max_elastic_ips') { should eq 5 }
3681
+ its('ec2.max_instances') { should eq 20 }
3682
+ its('ec2.vpc_max_elastic_ips') { should eq 5 }
3683
+ its('ec2.default_vpc') { should eq 'none' }
3684
+ its('rds.DBInstances.used') { should eq 0 }
3685
+ its('rds.DBInstances.max') { should eq 40 }
3686
+ its('rds.ReservedDBInstances.used') { should eq 0 }
3687
+ its('rds.ReservedDBInstances.max') { should eq 40 }
3688
+ its('rds.AllocatedStorage.used') { should eq 0 }
3689
+ its('rds.AllocatedStorage.max') { should eq 100000 }
3690
+ its('rds.DBSecurityGroups.used') { should eq 0 }
3691
+ its('rds.DBSecurityGroups.max') { should eq 25 }
3692
+ its('rds.AuthorizationsPerDBSecurityGroup.used') { should eq 0 }
3693
+ its('rds.AuthorizationsPerDBSecurityGroup.max') { should eq 20 }
3694
+ its('rds.DBParameterGroups.used') { should eq 1 }
3695
+ its('rds.DBParameterGroups.max') { should eq 50 }
3696
+ its('rds.ManualSnapshots.used') { should eq 0 }
3697
+ its('rds.ManualSnapshots.max') { should eq 100 }
3698
+ its('rds.EventSubscriptions.used') { should eq 0 }
3699
+ its('rds.EventSubscriptions.max') { should eq 20 }
3700
+ its('rds.DBSubnetGroups.used') { should eq 1 }
3701
+ its('rds.DBSubnetGroups.max') { should eq 50 }
3702
+ its('rds.OptionGroups.used') { should eq 0 }
3703
+ its('rds.OptionGroups.max') { should eq 20 }
3704
+ its('rds.SubnetsPerDBSubnetGroup.used') { should eq 2 }
3705
+ its('rds.SubnetsPerDBSubnetGroup.max') { should eq 20 }
3706
+ its('rds.ReadReplicasPerMaster.used') { should eq 0 }
3707
+ its('rds.ReadReplicasPerMaster.max') { should eq 5 }
3708
+ its('rds.DBClusters.used') { should eq 0 }
3709
+ its('rds.DBClusters.max') { should eq 40 }
3710
+ its('rds.DBClusterParameterGroups.used') { should eq 0 }
3711
+ its('rds.DBClusterParameterGroups.max') { should eq 50 }
3712
+ its('rds.DBClusterRoles.used') { should eq 0 }
3713
+ its('rds.DBClusterRoles.max') { should eq 5 }
3714
+ its('lambda.total_code_size.limit') { should eq 80530636800 }
3715
+ its('lambda.total_code_size.usage') { should eq 2034651562 }
3716
+ its('lambda.code_size_unzipped.limit') { should eq 262144000 }
3717
+ its('lambda.code_size_zipped.limit') { should eq 52428800 }
3718
+ its('lambda.concurrent_executions.limit') { should eq 200 }
3719
+ its('lambda.unreserved_concurrent_executions.limit') { should eq 50 }
3720
+ its('lambda.function_count.usage') { should eq 8 }
3721
+ its('ses.max_24_hour_send') { should eq 200.0 }
3722
+ its('ses.max_send_rate') { should eq 1.0 }
3723
+ its('ses.sent_last_24_hours') { should eq 1.0 }
3724
+ end
3725
+ ```
3726
+
3727
+
3728
+ ## :unlock: Another way: Test with account_attribute type
3729
+
3730
+ ## <a name="account_attribute">account_attribute</a>
3731
+
3732
+ Account Attribute resource type.
3733
+
3734
+ ```ruby
3735
+ describe account_attribute('ec2') do
3736
+ its('supported_platforms') { should eq ["EC2", "VPC"] }
3737
+ its('vpc_max_security_groups_per_interface') { should eq 5 }
3738
+ its('max_elastic_ips') { should eq 5 }
3739
+ its('max_instances') { should eq 20 }
3740
+ its('vpc_max_elastic_ips') { should eq 5 }
3741
+ its('default_vpc') { should eq 'none' }
3742
+ end
3743
+
3744
+ describe account_attribute('rds') do
3745
+ its('DBInstances.used') { should eq 0 }
3746
+ its('DBInstances.max') { should eq 40 }
3747
+ its('ReservedDBInstances.used') { should eq 0 }
3748
+ its('ReservedDBInstances.max') { should eq 40 }
3749
+ its('AllocatedStorage.used') { should eq 0 }
3750
+ its('AllocatedStorage.max') { should eq 100000 }
3751
+ its('DBSecurityGroups.used') { should eq 0 }
3752
+ its('DBSecurityGroups.max') { should eq 25 }
3753
+ its('AuthorizationsPerDBSecurityGroup.used') { should eq 0 }
3754
+ its('AuthorizationsPerDBSecurityGroup.max') { should eq 20 }
3755
+ its('DBParameterGroups.used') { should eq 1 }
3756
+ its('DBParameterGroups.max') { should eq 50 }
3757
+ its('ManualSnapshots.used') { should eq 0 }
3758
+ its('ManualSnapshots.max') { should eq 100 }
3759
+ its('EventSubscriptions.used') { should eq 0 }
3760
+ its('EventSubscriptions.max') { should eq 20 }
3761
+ its('DBSubnetGroups.used') { should eq 1 }
3762
+ its('DBSubnetGroups.max') { should eq 50 }
3763
+ its('OptionGroups.used') { should eq 0 }
3764
+ its('OptionGroups.max') { should eq 20 }
3765
+ its('SubnetsPerDBSubnetGroup.used') { should eq 2 }
3766
+ its('SubnetsPerDBSubnetGroup.max') { should eq 20 }
3767
+ its('ReadReplicasPerMaster.used') { should eq 0 }
3768
+ its('ReadReplicasPerMaster.max') { should eq 5 }
3769
+ its('DBClusters.used') { should eq 0 }
3770
+ its('DBClusters.max') { should eq 40 }
3771
+ its('DBClusterParameterGroups.used') { should eq 0 }
3772
+ its('DBClusterParameterGroups.max') { should eq 50 }
3773
+ its('DBClusterRoles.used') { should eq 0 }
3774
+ its('DBClusterRoles.max') { should eq 5 }
3775
+ end
3776
+
3777
+ describe account_attribute('lambda') do
3778
+ its('total_code_size.limit') { should eq 80530636800 }
3779
+ its('total_code_size.usage') { should eq 2034651562 }
3780
+ its('code_size_unzipped.limit') { should eq 262144000 }
3781
+ its('code_size_zipped.limit') { should eq 52428800 }
3782
+ its('concurrent_executions.limit') { should eq 200 }
3783
+ its('unreserved_concurrent_executions.limit') { should eq 50 }
3784
+ its('function_count.usage') { should eq 8 }
3785
+ end
3786
+
3787
+ describe account_attribute('ses') do
3788
+ its('max_24_hour_send') { should eq 200.0 }
3789
+ its('max_send_rate') { should eq 1.0 }
3790
+ its('sent_last_24_hours') { should eq 1.0 }
3791
+ end
3792
+
3793
+ ```
3794
+
3795
+
3796
+ ## :unlock: Another way: Test with separated resource types
3797
+
3798
+ [ec2_account_attributes](#ec2_account_attributes)
3799
+ | [rds_account_attributes](#rds_account_attributes)
3800
+ | [lambda_account_settings](#lambda_account_settings)
3801
+ | [ses_send_quota](#ses_send_quota)
3802
+ ## <a name="ec2_account_attributes">ec2_account_attributes</a>
3803
+
3804
+ Ec2AccountAttributes account attributes.
3805
+
3806
+ ```ruby
3807
+ describe ec2_account_attributes do
3808
+ its(:supported_platforms) { should include 'VPC' }
3809
+ its(:max_instances) { should eq 20 }
3810
+ end
3811
+ ```
3812
+
3813
+ ### its(:supported_platforms), its(:vpc_max_security_groups_per_interface), its(:max_elastic_ips), its(:max_instances), its(:vpc_max_elastic_ips), its(:default_vpc)
3814
+ ## <a name="rds_account_attributes">rds_account_attributes</a>
3815
+
3816
+ RdsAccountAttributes account attributes.
3817
+
3818
+ ```ruby
3819
+ describe rds_account_attributes do
3820
+ its('DBInstances.used') { should eq 0 }
3821
+ its('DBInstances.max') { should eq 40 }
3822
+ end
3823
+ ```
3824
+
3825
+
3826
+ ## <a name="lambda_account_settings">lambda_account_settings</a>
3827
+
3828
+ LambdaAccountSettings account attributes.
3829
+
3830
+ ```ruby
3831
+ describe lambda_account_settings do
3832
+ its('total_code_size.limit') { should eq 80_530_636_800 }
3833
+ its('total_code_size.usage') { should eq 2_034_651_562 }
3834
+ its('function_count.usage') { should eq 8 }
3835
+ end
3836
+ ```
3837
+
3838
+
3839
+
3840
+ ## <a name="ses_send_quota">ses_send_quota</a>
3841
+
3842
+ SesSendQuota account attributes.
3843
+
3844
+ ```ruby
3845
+ describe ses_send_quota do
3846
+ its(:max_24_hour_send) { should eq 200.0 }
3847
+ its(:max_send_rate) { should eq 1.0 }
3848
+ its(:sent_last_24_hours) { should eq 1.0 }
3849
+ end
3850
+ ```
3851
+
3852
+ ### its(:max_24_hour_send), its(:max_send_rate), its(:sent_last_24_hours)