awspec-api_gateway_extended 1.2.3

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