awspec 1.25.1 → 1.25.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +5 -7
- data/.rubocop.yml +66 -62
- data/Gemfile +3 -1
- data/Rakefile +5 -3
- data/awspec.gemspec +4 -2
- data/bin/console +1 -0
- data/bin/toolbox +1 -0
- data/doc/resource_types.md +17 -17
- data/exe/awspec +1 -0
- data/lib/awspec/cli.rb +2 -0
- data/lib/awspec/command/generate.rb +11 -9
- data/lib/awspec/config.rb +2 -0
- data/lib/awspec/error.rb +4 -0
- data/lib/awspec/ext/array.rb +5 -2
- data/lib/awspec/ext/hash.rb +5 -2
- data/lib/awspec/ext/string.rb +2 -0
- data/lib/awspec/ext/struct.rb +2 -0
- data/lib/awspec/ext.rb +2 -0
- data/lib/awspec/generator/doc/type/account.rb +4 -4
- data/lib/awspec/generator/doc/type/account_attribute.rb +4 -4
- data/lib/awspec/generator/doc/type/account_attribute_base.rb +3 -2
- data/lib/awspec/generator/doc/type/acm.rb +4 -2
- data/lib/awspec/generator/doc/type/alb.rb +5 -3
- data/lib/awspec/generator/doc/type/alb_listener.rb +3 -1
- data/lib/awspec/generator/doc/type/alb_target_group.rb +3 -1
- data/lib/awspec/generator/doc/type/ami.rb +4 -2
- data/lib/awspec/generator/doc/type/apigateway.rb +2 -0
- data/lib/awspec/generator/doc/type/autoscaling_group.rb +2 -0
- data/lib/awspec/generator/doc/type/base.rb +11 -8
- data/lib/awspec/generator/doc/type/batch_compute_environment.rb +6 -4
- data/lib/awspec/generator/doc/type/batch_job_definition.rb +2 -0
- data/lib/awspec/generator/doc/type/batch_job_queue.rb +2 -0
- data/lib/awspec/generator/doc/type/cloudformation_stack.rb +2 -0
- data/lib/awspec/generator/doc/type/cloudfront_distribution.rb +4 -2
- data/lib/awspec/generator/doc/type/cloudtrail.rb +2 -0
- data/lib/awspec/generator/doc/type/cloudwatch_alarm.rb +3 -1
- data/lib/awspec/generator/doc/type/cloudwatch_event.rb +2 -0
- data/lib/awspec/generator/doc/type/cloudwatch_logs.rb +2 -0
- data/lib/awspec/generator/doc/type/codebuild.rb +2 -0
- data/lib/awspec/generator/doc/type/codedeploy.rb +2 -0
- data/lib/awspec/generator/doc/type/codedeploy_deployment_group.rb +2 -0
- data/lib/awspec/generator/doc/type/cognito_identity_pool.rb +2 -0
- data/lib/awspec/generator/doc/type/cognito_user_pool.rb +2 -0
- data/lib/awspec/generator/doc/type/customer_gateway.rb +4 -2
- data/lib/awspec/generator/doc/type/directconnect_virtual_interface.rb +4 -2
- data/lib/awspec/generator/doc/type/dynamodb_table.rb +4 -2
- data/lib/awspec/generator/doc/type/ebs.rb +4 -2
- data/lib/awspec/generator/doc/type/ec2.rb +4 -2
- data/lib/awspec/generator/doc/type/ec2_account_attributes.rb +2 -0
- data/lib/awspec/generator/doc/type/ecr_repository.rb +2 -0
- data/lib/awspec/generator/doc/type/ecs_cluster.rb +4 -2
- data/lib/awspec/generator/doc/type/ecs_container_instance.rb +4 -2
- data/lib/awspec/generator/doc/type/ecs_service.rb +4 -2
- data/lib/awspec/generator/doc/type/ecs_task_definition.rb +4 -2
- data/lib/awspec/generator/doc/type/efs.rb +2 -0
- data/lib/awspec/generator/doc/type/eip.rb +2 -0
- data/lib/awspec/generator/doc/type/eks.rb +4 -2
- data/lib/awspec/generator/doc/type/eks_nodegroup.rb +4 -2
- data/lib/awspec/generator/doc/type/elasticache.rb +4 -2
- data/lib/awspec/generator/doc/type/elasticache_cache_parameter_group.rb +2 -0
- data/lib/awspec/generator/doc/type/elasticsearch.rb +2 -0
- data/lib/awspec/generator/doc/type/elastictranscoder_pipeline.rb +4 -2
- data/lib/awspec/generator/doc/type/elb.rb +5 -3
- data/lib/awspec/generator/doc/type/emr.rb +4 -2
- data/lib/awspec/generator/doc/type/firehose.rb +2 -0
- data/lib/awspec/generator/doc/type/iam_group.rb +3 -1
- data/lib/awspec/generator/doc/type/iam_policy.rb +2 -0
- data/lib/awspec/generator/doc/type/iam_role.rb +3 -1
- data/lib/awspec/generator/doc/type/iam_user.rb +3 -1
- data/lib/awspec/generator/doc/type/internet_gateway.rb +2 -0
- data/lib/awspec/generator/doc/type/kinesis.rb +2 -0
- data/lib/awspec/generator/doc/type/kms.rb +2 -0
- data/lib/awspec/generator/doc/type/lambda.rb +3 -1
- data/lib/awspec/generator/doc/type/lambda_account_settings.rb +2 -0
- data/lib/awspec/generator/doc/type/launch_configuration.rb +2 -0
- data/lib/awspec/generator/doc/type/launch_template.rb +2 -0
- data/lib/awspec/generator/doc/type/mq.rb +5 -3
- data/lib/awspec/generator/doc/type/msk.rb +2 -0
- data/lib/awspec/generator/doc/type/nat_gateway.rb +4 -2
- data/lib/awspec/generator/doc/type/network_acl.rb +4 -2
- data/lib/awspec/generator/doc/type/network_interface.rb +4 -2
- data/lib/awspec/generator/doc/type/nlb.rb +4 -2
- data/lib/awspec/generator/doc/type/nlb_listener.rb +3 -1
- data/lib/awspec/generator/doc/type/nlb_target_group.rb +3 -1
- data/lib/awspec/generator/doc/type/rds.rb +5 -3
- data/lib/awspec/generator/doc/type/rds_account_attributes.rb +2 -0
- data/lib/awspec/generator/doc/type/rds_db_cluster_parameter_group.rb +2 -0
- data/lib/awspec/generator/doc/type/rds_db_parameter_group.rb +2 -0
- data/lib/awspec/generator/doc/type/redshift.rb +5 -3
- data/lib/awspec/generator/doc/type/redshift_cluster_parameter_group.rb +2 -0
- data/lib/awspec/generator/doc/type/route53_hosted_zone.rb +2 -0
- data/lib/awspec/generator/doc/type/route_table.rb +2 -0
- data/lib/awspec/generator/doc/type/s3_bucket.rb +3 -1
- data/lib/awspec/generator/doc/type/secretsmanager.rb +2 -0
- data/lib/awspec/generator/doc/type/security_group.rb +4 -2
- data/lib/awspec/generator/doc/type/ses_identity.rb +4 -2
- data/lib/awspec/generator/doc/type/ses_send_quota.rb +2 -0
- data/lib/awspec/generator/doc/type/sns_topic.rb +5 -3
- data/lib/awspec/generator/doc/type/sqs.rb +2 -0
- data/lib/awspec/generator/doc/type/ssm_parameter.rb +2 -0
- data/lib/awspec/generator/doc/type/subnet.rb +4 -2
- data/lib/awspec/generator/doc/type/transit_gateway.rb +2 -0
- data/lib/awspec/generator/doc/type/vpc.rb +4 -2
- data/lib/awspec/generator/doc/type/vpc_endpoints.rb +2 -0
- data/lib/awspec/generator/doc/type/vpn_connection.rb +4 -2
- data/lib/awspec/generator/doc/type/vpn_gateway.rb +4 -2
- data/lib/awspec/generator/doc/type/waf_web_acl.rb +3 -1
- data/lib/awspec/generator/doc/type/wafregional_web_acl.rb +3 -1
- data/lib/awspec/generator/doc/type.rb +5 -3
- data/lib/awspec/generator/spec/acm.rb +4 -2
- data/lib/awspec/generator/spec/alb.rb +6 -4
- data/lib/awspec/generator/spec/alb_listener.rb +6 -4
- data/lib/awspec/generator/spec/autoscaling_group.rb +6 -4
- data/lib/awspec/generator/spec/cloudwatch_alarm.rb +4 -2
- data/lib/awspec/generator/spec/cloudwatch_event.rb +4 -2
- data/lib/awspec/generator/spec/cloudwatch_logs.rb +4 -2
- data/lib/awspec/generator/spec/codebuild.rb +4 -2
- data/lib/awspec/generator/spec/directconnect.rb +4 -2
- data/lib/awspec/generator/spec/ebs.rb +5 -4
- data/lib/awspec/generator/spec/ec2.rb +5 -2
- data/lib/awspec/generator/spec/efs.rb +4 -2
- data/lib/awspec/generator/spec/eip.rb +4 -2
- data/lib/awspec/generator/spec/elasticache.rb +5 -2
- data/lib/awspec/generator/spec/elasticsearch.rb +4 -2
- data/lib/awspec/generator/spec/elb.rb +8 -6
- data/lib/awspec/generator/spec/iam_group.rb +4 -2
- data/lib/awspec/generator/spec/iam_policy.rb +3 -0
- data/lib/awspec/generator/spec/iam_role.rb +4 -2
- data/lib/awspec/generator/spec/iam_user.rb +4 -2
- data/lib/awspec/generator/spec/internet_gateway.rb +6 -4
- data/lib/awspec/generator/spec/kms.rb +4 -2
- data/lib/awspec/generator/spec/lambda.rb +4 -2
- data/lib/awspec/generator/spec/nat_gateway.rb +6 -4
- data/lib/awspec/generator/spec/network_acl.rb +15 -13
- data/lib/awspec/generator/spec/network_interface.rb +13 -10
- data/lib/awspec/generator/spec/nlb.rb +6 -4
- data/lib/awspec/generator/spec/nlb_listener.rb +6 -4
- data/lib/awspec/generator/spec/rds.rb +5 -2
- data/lib/awspec/generator/spec/rds_db_cluster_parameter_group.rb +3 -2
- data/lib/awspec/generator/spec/rds_db_parameter_group.rb +3 -2
- data/lib/awspec/generator/spec/redshift.rb +5 -2
- data/lib/awspec/generator/spec/redshift_cluster_parameter_group.rb +3 -2
- data/lib/awspec/generator/spec/route53_hosted_zone.rb +4 -2
- data/lib/awspec/generator/spec/route_table.rb +12 -14
- data/lib/awspec/generator/spec/s3_bucket.rb +9 -6
- data/lib/awspec/generator/spec/security_group.rb +9 -8
- data/lib/awspec/generator/spec/subnet.rb +6 -4
- data/lib/awspec/generator/spec/vpc.rb +5 -2
- data/lib/awspec/generator/template.rb +17 -15
- data/lib/awspec/generator.rb +4 -2
- data/lib/awspec/helper/client_wrap.rb +5 -1
- data/lib/awspec/helper/color.rb +2 -0
- data/lib/awspec/helper/finder/account_attributes.rb +8 -6
- data/lib/awspec/helper/finder/acm.rb +4 -0
- data/lib/awspec/helper/finder/alb.rb +7 -5
- data/lib/awspec/helper/finder/ami.rb +4 -0
- data/lib/awspec/helper/finder/apigateway.rb +2 -0
- data/lib/awspec/helper/finder/autoscaling.rb +3 -0
- data/lib/awspec/helper/finder/batch.rb +2 -0
- data/lib/awspec/helper/finder/cloudformation.rb +2 -0
- data/lib/awspec/helper/finder/cloudfront.rb +3 -0
- data/lib/awspec/helper/finder/cloudtrail.rb +2 -0
- data/lib/awspec/helper/finder/cloudwatch.rb +3 -0
- data/lib/awspec/helper/finder/cloudwatch_event.rb +2 -0
- data/lib/awspec/helper/finder/cloudwatch_logs.rb +10 -5
- data/lib/awspec/helper/finder/codebuild.rb +3 -0
- data/lib/awspec/helper/finder/codedeploy.rb +2 -0
- data/lib/awspec/helper/finder/cognito_identity_pool.rb +2 -0
- data/lib/awspec/helper/finder/cognito_user_pool.rb +2 -0
- data/lib/awspec/helper/finder/directconnect.rb +2 -0
- data/lib/awspec/helper/finder/dynamodb.rb +2 -0
- data/lib/awspec/helper/finder/ebs.rb +5 -0
- data/lib/awspec/helper/finder/ec2.rb +16 -10
- data/lib/awspec/helper/finder/ecr.rb +2 -0
- data/lib/awspec/helper/finder/ecs.rb +5 -2
- data/lib/awspec/helper/finder/efs.rb +5 -4
- data/lib/awspec/helper/finder/eks.rb +2 -0
- data/lib/awspec/helper/finder/elasticache.rb +3 -1
- data/lib/awspec/helper/finder/elasticsearch.rb +3 -1
- data/lib/awspec/helper/finder/elastictranscoder.rb +3 -0
- data/lib/awspec/helper/finder/elb.rb +6 -4
- data/lib/awspec/helper/finder/emr.rb +2 -0
- data/lib/awspec/helper/finder/firehose.rb +2 -0
- data/lib/awspec/helper/finder/iam.rb +16 -12
- data/lib/awspec/helper/finder/kinesis.rb +2 -0
- data/lib/awspec/helper/finder/kms.rb +3 -1
- data/lib/awspec/helper/finder/lambda.rb +3 -0
- data/lib/awspec/helper/finder/mq.rb +3 -1
- data/lib/awspec/helper/finder/msk.rb +2 -0
- data/lib/awspec/helper/finder/nlb.rb +11 -8
- data/lib/awspec/helper/finder/rds.rb +4 -1
- data/lib/awspec/helper/finder/redshift.rb +4 -1
- data/lib/awspec/helper/finder/route53.rb +4 -1
- data/lib/awspec/helper/finder/s3.rb +4 -2
- data/lib/awspec/helper/finder/secretsmanager.rb +2 -0
- data/lib/awspec/helper/finder/security_group.rb +2 -0
- data/lib/awspec/helper/finder/ses.rb +2 -0
- data/lib/awspec/helper/finder/sns_topic.rb +5 -3
- data/lib/awspec/helper/finder/sqs.rb +2 -0
- data/lib/awspec/helper/finder/ssm_parameter.rb +4 -1
- data/lib/awspec/helper/finder/subnet.rb +3 -0
- data/lib/awspec/helper/finder/vpc.rb +12 -6
- data/lib/awspec/helper/finder/vpc_endpoints.rb +2 -0
- data/lib/awspec/helper/finder/waf.rb +5 -0
- data/lib/awspec/helper/finder/wafregional.rb +5 -0
- data/lib/awspec/helper/finder.rb +3 -1
- data/lib/awspec/helper/states.rb +4 -2
- data/lib/awspec/helper/type.rb +8 -4
- data/lib/awspec/helper.rb +2 -0
- data/lib/awspec/matcher/be_allowed.rb +2 -0
- data/lib/awspec/matcher/be_allowed_action.rb +2 -0
- data/lib/awspec/matcher/be_attached_to.rb +3 -0
- data/lib/awspec/matcher/be_connected_to_vpc.rb +2 -0
- data/lib/awspec/matcher/be_denied.rb +2 -0
- data/lib/awspec/matcher/be_opened.rb +2 -0
- data/lib/awspec/matcher/be_opened_only.rb +2 -0
- data/lib/awspec/matcher/belong_to_alb.rb +4 -0
- data/lib/awspec/matcher/belong_to_cache_subnet_group.rb +2 -0
- data/lib/awspec/matcher/belong_to_cluster_subnet_group.rb +2 -0
- data/lib/awspec/matcher/belong_to_db_subnet_group.rb +2 -0
- data/lib/awspec/matcher/belong_to_domain.rb +2 -0
- data/lib/awspec/matcher/belong_to_iam_group.rb +2 -0
- data/lib/awspec/matcher/belong_to_metric.rb +2 -0
- data/lib/awspec/matcher/belong_to_nlb.rb +4 -0
- data/lib/awspec/matcher/belong_to_replication_group.rb +2 -0
- data/lib/awspec/matcher/belong_to_subnet.rb +5 -0
- data/lib/awspec/matcher/belong_to_subnets.rb +2 -0
- data/lib/awspec/matcher/belong_to_vpc.rb +4 -0
- data/lib/awspec/matcher/have_attribute_definition.rb +2 -0
- data/lib/awspec/matcher/have_cluster_parameter_group.rb +2 -0
- data/lib/awspec/matcher/have_custom_response_error_code.rb +3 -2
- data/lib/awspec/matcher/have_db_parameter_group.rb +2 -0
- data/lib/awspec/matcher/have_env_var.rb +2 -0
- data/lib/awspec/matcher/have_env_var_value.rb +2 -0
- data/lib/awspec/matcher/have_env_vars.rb +2 -0
- data/lib/awspec/matcher/have_inline_policy.rb +2 -0
- data/lib/awspec/matcher/have_key_policy.rb +2 -0
- data/lib/awspec/matcher/have_key_schema.rb +2 -0
- data/lib/awspec/matcher/have_metric_filter.rb +2 -0
- data/lib/awspec/matcher/have_network_interface.rb +2 -0
- data/lib/awspec/matcher/have_option_group.rb +2 -0
- data/lib/awspec/matcher/have_origin.rb +3 -2
- data/lib/awspec/matcher/have_private_ip_address.rb +2 -0
- data/lib/awspec/matcher/have_record_set.rb +3 -1
- data/lib/awspec/matcher/have_route.rb +5 -3
- data/lib/awspec/matcher/have_rule.rb +3 -0
- data/lib/awspec/matcher/have_subscription_attributes.rb +3 -0
- data/lib/awspec/matcher/have_subscription_filter.rb +2 -0
- data/lib/awspec/matcher/have_tag.rb +2 -0
- data/lib/awspec/matcher/have_vpc_peering_connection.rb +2 -0
- data/lib/awspec/matcher/include_subscribed.rb +2 -0
- data/lib/awspec/matcher.rb +2 -0
- data/lib/awspec/resource_reader.rb +3 -0
- data/lib/awspec/setup.rb +7 -5
- data/lib/awspec/shared_context.rb +3 -0
- data/lib/awspec/stub/account.rb +2 -0
- data/lib/awspec/stub/acm.rb +2 -0
- data/lib/awspec/stub/alb.rb +3 -1
- data/lib/awspec/stub/alb_listener.rb +4 -3
- data/lib/awspec/stub/alb_target_group.rb +3 -1
- data/lib/awspec/stub/ami.rb +2 -0
- data/lib/awspec/stub/apigateway.rb +2 -0
- data/lib/awspec/stub/autoscaling_group.rb +6 -4
- data/lib/awspec/stub/batch_compute_environment.rb +2 -0
- data/lib/awspec/stub/batch_job_definition.rb +2 -0
- data/lib/awspec/stub/batch_job_queue.rb +2 -0
- data/lib/awspec/stub/cloudformation_stack.rb +4 -2
- data/lib/awspec/stub/cloudfront_distribution.rb +6 -4
- data/lib/awspec/stub/cloudtrail.rb +2 -0
- data/lib/awspec/stub/cloudwatch_logs.rb +2 -0
- data/lib/awspec/stub/codebuild.rb +5 -3
- data/lib/awspec/stub/codedeploy.rb +2 -0
- data/lib/awspec/stub/codedeploy_deployment_group.rb +2 -0
- data/lib/awspec/stub/cognito_identity_pool.rb +2 -0
- data/lib/awspec/stub/cognito_user_pool.rb +2 -0
- data/lib/awspec/stub/directconnect_virtual_interface.rb +2 -0
- data/lib/awspec/stub/duplicated_resource_type.rb +2 -0
- data/lib/awspec/stub/dynamodb_table.rb +2 -0
- data/lib/awspec/stub/ebs.rb +2 -0
- data/lib/awspec/stub/ec2.rb +2 -0
- data/lib/awspec/stub/ec2_has_multi_security_groups.rb +2 -0
- data/lib/awspec/stub/ec2_non_existing.rb +2 -0
- data/lib/awspec/stub/ecr_repository.rb +2 -0
- data/lib/awspec/stub/ecs.rb +13 -22
- data/lib/awspec/stub/ecs_cluster.rb +4 -4
- data/lib/awspec/stub/ecs_container_instance.rb +3 -2
- data/lib/awspec/stub/ecs_service.rb +4 -4
- data/lib/awspec/stub/ecs_task_definition.rb +9 -14
- data/lib/awspec/stub/efs.rb +2 -0
- data/lib/awspec/stub/eip.rb +2 -0
- data/lib/awspec/stub/eks.rb +5 -3
- data/lib/awspec/stub/eks_nodegroup.rb +2 -0
- data/lib/awspec/stub/elasticache.rb +2 -0
- data/lib/awspec/stub/elasticache_cache_parameter_group.rb +2 -0
- data/lib/awspec/stub/elasticsearch.rb +2 -0
- data/lib/awspec/stub/elastictranscoder_pipeline.rb +2 -0
- data/lib/awspec/stub/elb.rb +2 -0
- data/lib/awspec/stub/emr.rb +2 -0
- data/lib/awspec/stub/firehose.rb +2 -0
- data/lib/awspec/stub/iam_group.rb +3 -2
- data/lib/awspec/stub/iam_policy.rb +2 -0
- data/lib/awspec/stub/iam_role.rb +3 -2
- data/lib/awspec/stub/iam_user.rb +3 -2
- data/lib/awspec/stub/internet_gateway.rb +2 -0
- data/lib/awspec/stub/kinesis.rb +8 -6
- data/lib/awspec/stub/kms.rb +2 -0
- data/lib/awspec/stub/lambda.rb +2 -0
- data/lib/awspec/stub/launch_configuration.rb +2 -0
- data/lib/awspec/stub/launch_template.rb +2 -0
- data/lib/awspec/stub/mq.rb +5 -3
- data/lib/awspec/stub/msk.rb +5 -3
- data/lib/awspec/stub/nat_gateway.rb +2 -0
- data/lib/awspec/stub/network_acl.rb +2 -0
- data/lib/awspec/stub/network_interface.rb +2 -0
- data/lib/awspec/stub/nlb.rb +3 -1
- data/lib/awspec/stub/nlb_listener.rb +4 -3
- data/lib/awspec/stub/nlb_target_group.rb +3 -1
- data/lib/awspec/stub/rds.rb +2 -0
- data/lib/awspec/stub/rds_db_cluster_parameter_group.rb +2 -0
- data/lib/awspec/stub/rds_db_parameter_group.rb +2 -0
- data/lib/awspec/stub/redshift.rb +2 -0
- data/lib/awspec/stub/redshift_cluster_parameter_group.rb +2 -0
- data/lib/awspec/stub/route53_hosted_zone.rb +2 -0
- data/lib/awspec/stub/route_table.rb +2 -0
- data/lib/awspec/stub/s3_bucket.rb +2 -0
- data/lib/awspec/stub/secretsmanager.rb +2 -0
- data/lib/awspec/stub/security_group.rb +2 -0
- data/lib/awspec/stub/ses_identity.rb +2 -0
- data/lib/awspec/stub/sns_topic.rb +3 -1
- data/lib/awspec/stub/sns_topic_error.rb +6 -2
- data/lib/awspec/stub/sqs.rb +2 -0
- data/lib/awspec/stub/ssm_parameter.rb +2 -0
- data/lib/awspec/stub/subnet.rb +2 -0
- data/lib/awspec/stub/transit_gateway.rb +2 -0
- data/lib/awspec/stub/vpc.rb +2 -0
- data/lib/awspec/stub/vpc_endpoints.rb +2 -0
- data/lib/awspec/stub/waf_web_acl.rb +2 -0
- data/lib/awspec/stub/wafregional_web_acl.rb +2 -0
- data/lib/awspec/stub.rb +3 -1
- data/lib/awspec/toolbox.rb +2 -0
- data/lib/awspec/type/account.rb +4 -2
- data/lib/awspec/type/account_attribute.rb +5 -2
- data/lib/awspec/type/account_attribute_base.rb +2 -0
- data/lib/awspec/type/acm.rb +8 -6
- data/lib/awspec/type/alb.rb +8 -3
- data/lib/awspec/type/alb_listener.rb +4 -0
- data/lib/awspec/type/alb_target_group.rb +3 -0
- data/lib/awspec/type/ami.rb +5 -3
- data/lib/awspec/type/apigateway.rb +9 -3
- data/lib/awspec/type/autoscaling_group.rb +3 -0
- data/lib/awspec/type/base.rb +6 -3
- data/lib/awspec/type/batch_compute_environment.rb +6 -4
- data/lib/awspec/type/batch_job_definition.rb +2 -0
- data/lib/awspec/type/batch_job_queue.rb +4 -2
- data/lib/awspec/type/cloudformation_stack.rb +2 -0
- data/lib/awspec/type/cloudfront_distribution.rb +11 -5
- data/lib/awspec/type/cloudtrail.rb +2 -0
- data/lib/awspec/type/cloudwatch_alarm.rb +2 -0
- data/lib/awspec/type/cloudwatch_event.rb +2 -0
- data/lib/awspec/type/cloudwatch_logs.rb +2 -0
- data/lib/awspec/type/codebuild.rb +2 -0
- data/lib/awspec/type/codedeploy.rb +2 -0
- data/lib/awspec/type/codedeploy_deployment_group.rb +4 -0
- data/lib/awspec/type/cognito_identity_pool.rb +2 -0
- data/lib/awspec/type/cognito_user_pool.rb +2 -0
- data/lib/awspec/type/customer_gateway.rb +5 -3
- data/lib/awspec/type/directconnect_virtual_interface.rb +5 -3
- data/lib/awspec/type/dynamodb_table.rb +5 -3
- data/lib/awspec/type/ebs.rb +6 -3
- data/lib/awspec/type/ec2.rb +10 -0
- data/lib/awspec/type/ec2_account_attributes.rb +2 -0
- data/lib/awspec/type/ecr_repository.rb +2 -0
- data/lib/awspec/type/ecs_cluster.rb +5 -2
- data/lib/awspec/type/ecs_container_instance.rb +4 -2
- data/lib/awspec/type/ecs_service.rb +5 -2
- data/lib/awspec/type/ecs_task_definition.rb +4 -2
- data/lib/awspec/type/efs.rb +3 -0
- data/lib/awspec/type/eip.rb +3 -0
- data/lib/awspec/type/eks.rb +4 -2
- data/lib/awspec/type/eks_nodegroup.rb +4 -2
- data/lib/awspec/type/elasticache.rb +7 -3
- data/lib/awspec/type/elasticache_cache_parameter_group.rb +3 -0
- data/lib/awspec/type/elasticsearch.rb +2 -0
- data/lib/awspec/type/elastictranscoder_pipeline.rb +5 -3
- data/lib/awspec/type/elb.rb +11 -3
- data/lib/awspec/type/emr.rb +8 -6
- data/lib/awspec/type/firehose.rb +4 -2
- data/lib/awspec/type/iam_group.rb +4 -0
- data/lib/awspec/type/iam_policy.rb +5 -0
- data/lib/awspec/type/iam_role.rb +3 -0
- data/lib/awspec/type/iam_user.rb +3 -0
- data/lib/awspec/type/internet_gateway.rb +2 -0
- data/lib/awspec/type/kinesis.rb +3 -0
- data/lib/awspec/type/kms.rb +3 -0
- data/lib/awspec/type/lambda.rb +2 -0
- data/lib/awspec/type/lambda_account_settings.rb +2 -0
- data/lib/awspec/type/launch_configuration.rb +3 -0
- data/lib/awspec/type/launch_template.rb +3 -0
- data/lib/awspec/type/mq.rb +7 -3
- data/lib/awspec/type/msk.rb +5 -3
- data/lib/awspec/type/nat_gateway.rb +5 -3
- data/lib/awspec/type/network_acl.rb +9 -2
- data/lib/awspec/type/network_interface.rb +9 -3
- data/lib/awspec/type/nlb.rb +6 -3
- data/lib/awspec/type/nlb_listener.rb +4 -0
- data/lib/awspec/type/nlb_target_group.rb +3 -0
- data/lib/awspec/type/rds.rb +7 -3
- data/lib/awspec/type/rds_account_attributes.rb +2 -0
- data/lib/awspec/type/rds_db_cluster_parameter_group.rb +3 -0
- data/lib/awspec/type/rds_db_parameter_group.rb +5 -1
- data/lib/awspec/type/redshift.rb +7 -3
- data/lib/awspec/type/redshift_cluster_parameter_group.rb +2 -0
- data/lib/awspec/type/resource_base.rb +2 -0
- data/lib/awspec/type/route53_hosted_zone.rb +7 -2
- data/lib/awspec/type/route_table.rb +12 -0
- data/lib/awspec/type/s3_bucket.rb +6 -3
- data/lib/awspec/type/secretsmanager.rb +2 -0
- data/lib/awspec/type/security_group.rb +14 -2
- data/lib/awspec/type/ses_identity.rb +8 -6
- data/lib/awspec/type/ses_send_quota.rb +2 -0
- data/lib/awspec/type/sns_topic.rb +4 -0
- data/lib/awspec/type/sqs.rb +4 -0
- data/lib/awspec/type/ssm_parameter.rb +3 -0
- data/lib/awspec/type/subnet.rb +6 -3
- data/lib/awspec/type/transit_gateway.rb +2 -0
- data/lib/awspec/type/vpc.rb +7 -3
- data/lib/awspec/type/vpc_endpoints.rb +5 -3
- data/lib/awspec/type/vpn_connection.rb +5 -3
- data/lib/awspec/type/vpn_gateway.rb +5 -3
- data/lib/awspec/type/waf_web_acl.rb +3 -0
- data/lib/awspec/type/wafregional_web_acl.rb +3 -0
- data/lib/awspec/version.rb +3 -1
- data/lib/awspec.rb +2 -0
- metadata +16 -16
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Awspec::Generator
|
2
4
|
module Spec
|
3
5
|
class Kms
|
@@ -5,11 +7,12 @@ module Awspec::Generator
|
|
5
7
|
def generate_all
|
6
8
|
aliases = select_all_kms_aliases.select { |kms_alias| customer_managed_key?(kms_alias) }
|
7
9
|
raise 'Not Found alias' if aliases.empty?
|
10
|
+
|
8
11
|
ERB.new(keys_spec_template, nil, '-').result(binding).chomp
|
9
12
|
end
|
10
13
|
|
11
14
|
def keys_spec_template
|
12
|
-
|
15
|
+
<<-'EOF'
|
13
16
|
<% aliases.each do |kms_alias| %>
|
14
17
|
describe kms('<%= kms_alias.alias_name.split('/').last %>') do
|
15
18
|
it { should exist }
|
@@ -19,7 +22,6 @@ describe kms('<%= kms_alias.alias_name.split('/').last %>') do
|
|
19
22
|
end
|
20
23
|
<% end %>
|
21
24
|
EOF
|
22
|
-
template
|
23
25
|
end
|
24
26
|
|
25
27
|
private
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Awspec::Generator
|
2
4
|
module Spec
|
3
5
|
class Lambda
|
@@ -5,11 +7,12 @@ module Awspec::Generator
|
|
5
7
|
def generate_all
|
6
8
|
lambda_functions = select_all_lambda_functions
|
7
9
|
raise 'Not Found lambda' if lambda_functions.empty?
|
10
|
+
|
8
11
|
ERB.new(lambda_spec_template, nil, '-').result(binding).chomp
|
9
12
|
end
|
10
13
|
|
11
14
|
def lambda_spec_template
|
12
|
-
|
15
|
+
<<-'EOF'
|
13
16
|
<% lambda_functions.each do |function| %>
|
14
17
|
describe lambda('<%= function.function_name %>') do
|
15
18
|
it { should exist }
|
@@ -22,7 +25,6 @@ describe lambda('<%= function.function_name %>') do
|
|
22
25
|
end
|
23
26
|
<% end %>
|
24
27
|
EOF
|
25
|
-
template
|
26
28
|
end
|
27
29
|
end
|
28
30
|
end
|
@@ -1,12 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Awspec::Generator
|
2
4
|
module Spec
|
3
5
|
class NatGateway
|
4
6
|
include Awspec::Helper::Finder
|
5
7
|
def generate_by_vpc_id(vpc_id)
|
6
|
-
describes = %w
|
7
|
-
|
8
|
+
describes = %w[
|
9
|
+
]
|
8
10
|
vpc = find_vpc(vpc_id)
|
9
11
|
raise 'Not Found VPC' unless vpc
|
12
|
+
|
10
13
|
@vpc_id = vpc[:vpc_id]
|
11
14
|
@vpc_tag_name = vpc.tag_name
|
12
15
|
nat_gateways = select_nat_gateway_by_vpc_id(@vpc_id)
|
@@ -18,7 +21,7 @@ module Awspec::Generator
|
|
18
21
|
end
|
19
22
|
|
20
23
|
def nat_gateway_spec_template
|
21
|
-
|
24
|
+
<<-'EOF'
|
22
25
|
describe nat_gateway('<%= nat_gateway_id %>') do
|
23
26
|
it { should exist }
|
24
27
|
it { should be_<%= nat_gateway.state %> }
|
@@ -32,7 +35,6 @@ describe nat_gateway('<%= nat_gateway_id %>') do
|
|
32
35
|
<% end %>
|
33
36
|
end
|
34
37
|
EOF
|
35
|
-
template
|
36
38
|
end
|
37
39
|
end
|
38
40
|
end
|
@@ -1,12 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Awspec::Generator
|
2
4
|
module Spec
|
3
5
|
class NetworkAcl
|
4
6
|
include Awspec::Helper::Finder
|
5
7
|
def generate_by_vpc_id(vpc_id)
|
6
|
-
describes = %w
|
7
|
-
|
8
|
+
describes = %w[
|
9
|
+
]
|
8
10
|
vpc = find_vpc(vpc_id)
|
9
11
|
raise 'Not Found VPC' unless vpc
|
12
|
+
|
10
13
|
@vpc_id = vpc[:vpc_id]
|
11
14
|
@vpc_tag_name = vpc.tag_name
|
12
15
|
network_acls = select_network_acl_by_vpc_id(@vpc_id)
|
@@ -31,9 +34,9 @@ module Awspec::Generator
|
|
31
34
|
acl.associations.each do |a|
|
32
35
|
subnet = find_subnet(a.subnet_id)
|
33
36
|
spec = if subnet.tag_name
|
34
|
-
"it { should have_subnet('
|
37
|
+
"it { should have_subnet('#{subnet.tag_name}') }"
|
35
38
|
else
|
36
|
-
"it { should have_subnet('
|
39
|
+
"it { should have_subnet('#{subnet.subnet_id}') }"
|
37
40
|
end
|
38
41
|
specs.push(spec)
|
39
42
|
end
|
@@ -47,23 +50,23 @@ module Awspec::Generator
|
|
47
50
|
line = ''
|
48
51
|
inout = 'inbound'
|
49
52
|
inout = 'outbound' if entry.egress
|
50
|
-
line +=
|
53
|
+
line += "its(:#{inout}) { should"
|
51
54
|
actions = { allow: 'be_allowed', deny: 'be_denied' }
|
52
|
-
line +=
|
55
|
+
line += " #{actions[entry.rule_action.to_sym]}"
|
53
56
|
port_range = entry.port_range
|
54
57
|
unless port_range.nil?
|
55
58
|
port = if port_range.from == port_range.to
|
56
59
|
port_range.from.to_s
|
57
60
|
else
|
58
|
-
"'
|
61
|
+
"'#{port_range.from}-#{port_range.to}'"
|
59
62
|
end
|
60
|
-
line +=
|
63
|
+
line += "(#{port})"
|
61
64
|
end
|
62
|
-
line += ".protocol('
|
63
|
-
line += ".source('
|
65
|
+
line += ".protocol('#{protocols[entry.protocol.to_i]}')"
|
66
|
+
line += ".source('#{entry.cidr_block}')"
|
64
67
|
rule_number = entry.rule_number.to_i
|
65
68
|
rule_number = "'*'" if rule_number == 32_767
|
66
|
-
line +=
|
69
|
+
line += ".rule_number(#{rule_number})"
|
67
70
|
line += ' }'
|
68
71
|
linespecs.push(line)
|
69
72
|
end
|
@@ -71,7 +74,7 @@ module Awspec::Generator
|
|
71
74
|
end
|
72
75
|
|
73
76
|
def network_acl_spec_template
|
74
|
-
|
77
|
+
<<-'EOF'
|
75
78
|
<%- if network_acl_tag_name -%>
|
76
79
|
describe network_acl('<%= network_acl_tag_name %>') do
|
77
80
|
<%- else -%>
|
@@ -89,7 +92,6 @@ describe network_acl('<%= network_acl_id %>') do
|
|
89
92
|
its(:outbound_entries_count) { should eq <%= inbound_entries_count %> }
|
90
93
|
end
|
91
94
|
EOF
|
92
|
-
template
|
93
95
|
end
|
94
96
|
end
|
95
97
|
end
|
@@ -1,12 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Awspec::Generator
|
2
4
|
module Spec
|
3
5
|
class NetworkInterface
|
4
6
|
include Awspec::Helper::Finder
|
5
7
|
def generate_by_vpc_id(vpc_id)
|
6
|
-
describes = %w
|
7
|
-
|
8
|
+
describes = %w[
|
9
|
+
]
|
8
10
|
vpc = find_vpc(vpc_id)
|
9
11
|
raise 'Not Found VPC' unless vpc
|
12
|
+
|
10
13
|
@vpc_id = vpc[:vpc_id]
|
11
14
|
@vpc_tag_name = vpc.tag_name
|
12
15
|
network_interfaces = select_network_interface_by_vpc_id(@vpc_id)
|
@@ -23,6 +26,7 @@ module Awspec::Generator
|
|
23
26
|
|
24
27
|
def generate_instance_spec(interface)
|
25
28
|
return unless interface.attachment.instance_id
|
29
|
+
|
26
30
|
instance = find_ec2(interface.attachment.instance_id)
|
27
31
|
instance_spec = if instance.tag_name
|
28
32
|
"it { should be_attached_to('#{instance.tag_name}')"
|
@@ -35,13 +39,13 @@ module Awspec::Generator
|
|
35
39
|
|
36
40
|
def generate_subnet_spec(interface)
|
37
41
|
return unless interface.subnet_id
|
42
|
+
|
38
43
|
subnet = find_subnet(interface.subnet_id)
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
subnet_spec
|
44
|
+
if subnet.tag_name
|
45
|
+
"it { should belong_to_subnet('#{subnet.tag_name}') }"
|
46
|
+
else
|
47
|
+
"it { should belong_to_subnet('#{subnet.subnet_id}') }"
|
48
|
+
end
|
45
49
|
end
|
46
50
|
|
47
51
|
def generate_linespecs(interface)
|
@@ -56,7 +60,7 @@ module Awspec::Generator
|
|
56
60
|
end
|
57
61
|
|
58
62
|
def network_interface_spec_template
|
59
|
-
|
63
|
+
<<-'EOF'
|
60
64
|
describe network_interface('<%= network_interface_id %>') do
|
61
65
|
it { should exist }
|
62
66
|
it { should be_<%= interface.status.tr('-', '_') %> }
|
@@ -73,7 +77,6 @@ describe network_interface('<%= network_interface_id %>') do
|
|
73
77
|
its(:private_ip_addresses_count) { should eq <%= interface.private_ip_addresses.count %> }
|
74
78
|
end
|
75
79
|
EOF
|
76
|
-
template
|
77
80
|
end
|
78
81
|
end
|
79
82
|
end
|
@@ -1,13 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Awspec::Generator
|
2
4
|
module Spec
|
3
5
|
class Nlb
|
4
6
|
include Awspec::Helper::Finder
|
5
7
|
def generate_by_vpc_id(vpc_id)
|
6
|
-
describes = %w
|
8
|
+
describes = %w[
|
7
9
|
load_balancer_name
|
8
|
-
|
10
|
+
]
|
9
11
|
vpc = find_vpc(vpc_id)
|
10
12
|
raise 'Not Found VPC' unless vpc
|
13
|
+
|
11
14
|
@vpc_id = vpc[:vpc_id]
|
12
15
|
@vpc_tag_name = vpc.tag_name
|
13
16
|
nlbs = select_nlb_by_vpc_id(@vpc_id)
|
@@ -19,7 +22,7 @@ module Awspec::Generator
|
|
19
22
|
end
|
20
23
|
|
21
24
|
def nlb_spec_template
|
22
|
-
|
25
|
+
<<-'EOF'
|
23
26
|
describe nlb('<%= nlb.load_balancer_name %>') do
|
24
27
|
it { should exist }
|
25
28
|
its(:load_balancer_arn) { should eq '<%= nlb.load_balancer_arn %>' }
|
@@ -31,7 +34,6 @@ describe nlb('<%= nlb.load_balancer_name %>') do
|
|
31
34
|
its(:ip_address_type) { should eq '<%= nlb.ip_address_type %>' }
|
32
35
|
end
|
33
36
|
EOF
|
34
|
-
template
|
35
37
|
end
|
36
38
|
end
|
37
39
|
end
|
@@ -1,13 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Awspec::Generator
|
2
4
|
module Spec
|
3
5
|
class NlbListener
|
4
6
|
include Awspec::Helper::Finder
|
5
7
|
def generate_by_vpc_id(vpc_id)
|
6
|
-
describes = %w
|
8
|
+
describes = %w[
|
7
9
|
load_balancer_arn port protocol ssl_policy
|
8
|
-
|
10
|
+
]
|
9
11
|
vpc = find_vpc(vpc_id)
|
10
12
|
raise 'Not Found VPC' unless vpc
|
13
|
+
|
11
14
|
@vpc_id = vpc[:vpc_id]
|
12
15
|
@vpc_tag_name = vpc.tag_name
|
13
16
|
nlbs = select_nlb_by_vpc_id(@vpc_id)
|
@@ -77,7 +80,7 @@ module Awspec::Generator
|
|
77
80
|
end
|
78
81
|
|
79
82
|
def nlb_listener_spec_template
|
80
|
-
|
83
|
+
<<-'EOF'
|
81
84
|
describe nlb_listener('<%= listener.listener_arn %>') do
|
82
85
|
it { should exist }
|
83
86
|
<%- describes.each do |describe| -%>
|
@@ -103,7 +106,6 @@ describe nlb_listener('<%= listener.listener_arn %>') do
|
|
103
106
|
<%- end -%>
|
104
107
|
end
|
105
108
|
EOF
|
106
|
-
template
|
107
109
|
end
|
108
110
|
end
|
109
111
|
end
|
@@ -1,13 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Awspec::Generator
|
2
4
|
module Spec
|
3
5
|
class Rds
|
4
6
|
include Awspec::Helper::Finder
|
5
7
|
def generate_by_vpc_id(vpc_id)
|
6
|
-
describes = %w
|
8
|
+
describes = %w[
|
7
9
|
db_instance_identifier db_instance_class multi_az availability_zone
|
8
|
-
|
10
|
+
]
|
9
11
|
vpc = find_vpc(vpc_id)
|
10
12
|
raise 'Not Found VPC' unless vpc
|
13
|
+
|
11
14
|
@vpc_id = vpc[:vpc_id]
|
12
15
|
@vpc_tag_name = vpc.tag_name
|
13
16
|
db_instances = select_rds_by_vpc_id(@vpc_id)
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Awspec::Generator
|
2
4
|
module Spec
|
3
5
|
class RdsDbClusterParameterGroup
|
@@ -9,14 +11,13 @@ module Awspec::Generator
|
|
9
11
|
end
|
10
12
|
|
11
13
|
def db_cluster_parameter_group_template
|
12
|
-
|
14
|
+
<<-'EOF'
|
13
15
|
describe rds_db_cluster_parameter_group('<%= @parameter_group %>') do
|
14
16
|
<% res.each do |key, value| %>
|
15
17
|
its('<%= key %>') { should eq '<%= value %>' }
|
16
18
|
<% end %>
|
17
19
|
end
|
18
20
|
EOF
|
19
|
-
template
|
20
21
|
end
|
21
22
|
end
|
22
23
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Awspec::Generator
|
2
4
|
module Spec
|
3
5
|
class RdsDbParameterGroup
|
@@ -9,14 +11,13 @@ module Awspec::Generator
|
|
9
11
|
end
|
10
12
|
|
11
13
|
def db_parameter_group_template
|
12
|
-
|
14
|
+
<<-'EOF'
|
13
15
|
describe rds_db_parameter_group('<%= @parameter_group %>') do
|
14
16
|
<% res.each do |key, value| %>
|
15
17
|
its('<%= key %>') { should eq '<%= value %>' }
|
16
18
|
<% end %>
|
17
19
|
end
|
18
20
|
EOF
|
19
|
-
template
|
20
21
|
end
|
21
22
|
end
|
22
23
|
end
|
@@ -1,17 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Awspec::Generator
|
2
4
|
module Spec
|
3
5
|
class Redshift
|
4
6
|
include Awspec::Helper::Finder
|
5
7
|
def generate_by_vpc_id(vpc_id)
|
6
|
-
describes = %w
|
8
|
+
describes = %w[
|
7
9
|
node_type master_username db_name availability_zone
|
8
10
|
allow_version_upgrade number_of_nodes publicly_accessible encrypted
|
9
11
|
kms_key_id enhanced_vpc_routing pending_actions maintenance_track_name
|
10
12
|
elastic_resize_number_of_node_options
|
11
|
-
|
13
|
+
]
|
12
14
|
|
13
15
|
vpc = find_vpc(vpc_id)
|
14
16
|
raise 'Not Found VPC' unless vpc
|
17
|
+
|
15
18
|
@vpc_id = vpc[:vpc_id]
|
16
19
|
@vpc_tag_name = vpc.tag_name
|
17
20
|
clusters = select_redshift_by_vpc_id(@vpc_id)
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Awspec::Generator
|
2
4
|
module Spec
|
3
5
|
class RedshiftClusterParameterGroup
|
@@ -9,14 +11,13 @@ module Awspec::Generator
|
|
9
11
|
end
|
10
12
|
|
11
13
|
def redshift_cluster_parameters_spec_template
|
12
|
-
|
14
|
+
<<-'EOF'
|
13
15
|
describe redshift_cluster_parameter_group('<%= @parameter_group %>') do
|
14
16
|
<% res.each do |key, value| %>
|
15
17
|
its('<%= key %>') { should eq '<%= value %>' }
|
16
18
|
<% end %>
|
17
19
|
end
|
18
20
|
EOF
|
19
|
-
template
|
20
21
|
end
|
21
22
|
end
|
22
23
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Awspec::Generator
|
2
4
|
module Spec
|
3
5
|
class Route53HostedZone
|
@@ -5,6 +7,7 @@ module Awspec::Generator
|
|
5
7
|
def generate_by_domain_name(id)
|
6
8
|
hosted_zone = find_hosted_zone(id)
|
7
9
|
raise 'Not Found Route53 Hosted Zone' unless hosted_zone
|
10
|
+
|
8
11
|
id = hosted_zone[:id]
|
9
12
|
selected = []
|
10
13
|
res = @route53_client.list_resource_record_sets({
|
@@ -56,7 +59,7 @@ EOF
|
|
56
59
|
end
|
57
60
|
|
58
61
|
def route53_hosted_zone_spec_template
|
59
|
-
|
62
|
+
<<-'EOF'
|
60
63
|
describe route53_hosted_zone('<%= hosted_zone.name %>') do
|
61
64
|
it { should exist }
|
62
65
|
its(:resource_record_set_count) { should eq <%= hosted_zone.resource_record_set_count %> }
|
@@ -65,7 +68,6 @@ describe route53_hosted_zone('<%= hosted_zone.name %>') do
|
|
65
68
|
<% end %>
|
66
69
|
end
|
67
70
|
EOF
|
68
|
-
template
|
69
71
|
end
|
70
72
|
end
|
71
73
|
end
|
@@ -1,12 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Awspec::Generator
|
2
4
|
module Spec
|
3
5
|
class RouteTable
|
4
6
|
include Awspec::Helper::Finder
|
5
7
|
def generate_by_vpc_id(vpc_id)
|
6
|
-
describes = %w
|
7
|
-
|
8
|
+
describes = %w[
|
9
|
+
]
|
8
10
|
vpc = find_vpc(vpc_id)
|
9
11
|
raise 'Not Found VPC' unless vpc
|
12
|
+
|
10
13
|
@vpc_id = vpc[:vpc_id]
|
11
14
|
@vpc_tag_name = vpc.tag_name
|
12
15
|
route_tables = select_route_table_by_vpc_id(@vpc_id)
|
@@ -47,6 +50,7 @@ module Awspec::Generator
|
|
47
50
|
linespecs = []
|
48
51
|
route_table.associations.each do |a|
|
49
52
|
next if a.subnet_id.nil?
|
53
|
+
|
50
54
|
subnet = find_subnet(a.subnet_id)
|
51
55
|
linespecs.push(ERB.new(route_table_spec_subnet_linetemplate, nil, '-').result(binding)) if subnet
|
52
56
|
end
|
@@ -54,54 +58,49 @@ module Awspec::Generator
|
|
54
58
|
end
|
55
59
|
|
56
60
|
def route_table_spec_gateway_linetemplate
|
57
|
-
|
61
|
+
<<-'EOF'
|
58
62
|
it { should have_route('<%= destination %>').target(gateway: '<%= route.gateway_id %>') }
|
59
63
|
EOF
|
60
|
-
template
|
61
64
|
end
|
62
65
|
|
63
66
|
def route_table_spec_instance_linetemplate
|
64
|
-
|
67
|
+
<<-'EOF'
|
65
68
|
<%- if instance.tag_name -%>
|
66
69
|
it { should have_route('<%= route.destination_cidr_block %>').target(instance: '<%= instance.tag_name %>') }
|
67
70
|
<%- else -%>
|
68
71
|
it { should have_route('<%= route.destination_cidr_block %>').target(instance: '<%= route.instance_id %>') }
|
69
72
|
<%- end -%>
|
70
73
|
EOF
|
71
|
-
template
|
72
74
|
end
|
73
75
|
|
74
76
|
def route_table_spec_connection_linetemplate
|
75
|
-
|
77
|
+
<<-'EOF'
|
76
78
|
<%- if connection.tag_name -%>
|
77
79
|
it { should have_route('<%= route.destination_cidr_block %>').target(vpc_peering_connection: '<%= connection.tag_name %>') }
|
78
80
|
<%- else -%>
|
79
81
|
it { should have_route('<%= route.destination_cidr_block %>').target(vpc_peering_connection: '<%= route.vpc_peering_connection_id %>') }
|
80
82
|
<%- end -%>
|
81
83
|
EOF
|
82
|
-
template
|
83
84
|
end
|
84
85
|
|
85
86
|
def route_table_spec_nat_linetemplate
|
86
|
-
|
87
|
+
<<-'EOF'
|
87
88
|
it { should have_route('<%= route.destination_cidr_block %>').target(nat: '<%= route.nat_gateway_id %>') }
|
88
89
|
EOF
|
89
|
-
template
|
90
90
|
end
|
91
91
|
|
92
92
|
def route_table_spec_subnet_linetemplate
|
93
|
-
|
93
|
+
<<-'EOF'
|
94
94
|
<%- if subnet.tag_name -%>
|
95
95
|
it { should have_subnet('<%= subnet.tag_name %>') }
|
96
96
|
<%- else -%>
|
97
97
|
it { should have_subnet('<%= subnet.subnet_id %>') }
|
98
98
|
<%- end -%>
|
99
99
|
EOF
|
100
|
-
template
|
101
100
|
end
|
102
101
|
|
103
102
|
def route_table_spec_template
|
104
|
-
|
103
|
+
<<-'EOF'
|
105
104
|
<%- if route_table_tag_name -%>
|
106
105
|
describe route_table('<%= route_table_tag_name %>') do
|
107
106
|
<%- else -%>
|
@@ -121,7 +120,6 @@ describe route_table('<%= route_table_id %>') do
|
|
121
120
|
<% end %>
|
122
121
|
end
|
123
122
|
EOF
|
124
|
-
template
|
125
123
|
end
|
126
124
|
end
|
127
125
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Awspec::Generator
|
2
4
|
module Spec
|
3
5
|
class S3Bucket
|
@@ -5,6 +7,7 @@ module Awspec::Generator
|
|
5
7
|
def generate_all
|
6
8
|
buckets = select_all_buckets
|
7
9
|
raise 'Not Found Bucket' if buckets.empty?
|
10
|
+
|
8
11
|
specs = buckets.map do |bucket|
|
9
12
|
content(bucket)
|
10
13
|
end
|
@@ -18,6 +21,7 @@ module Awspec::Generator
|
|
18
21
|
|
19
22
|
def generate_grant_specs(acl)
|
20
23
|
return [] unless acl
|
24
|
+
|
21
25
|
linespecs = []
|
22
26
|
acl.grants.each do |grant|
|
23
27
|
linespecs.push(ERB.new(grant_linetemplate, nil, '-').result(binding))
|
@@ -27,10 +31,9 @@ module Awspec::Generator
|
|
27
31
|
|
28
32
|
def grant_linetemplate
|
29
33
|
grantee = 'grant.grantee.display_name || grant.grantee.uri || grant.grantee.id'
|
30
|
-
|
34
|
+
<<-EOF
|
31
35
|
it { should have_acl_grant(grantee: '<%= #{grantee} %>', permission: '<%= grant.permission %>') }
|
32
36
|
EOF
|
33
|
-
template
|
34
37
|
end
|
35
38
|
|
36
39
|
def generate_lifecycle_rule_transitions_spec(transitions_rule)
|
@@ -47,13 +50,14 @@ it { should have_acl_grant(grantee: '<%= #{grantee} %>', permission: '<%= grant.
|
|
47
50
|
"#{k}: '#{v.inspect}'"
|
48
51
|
end
|
49
52
|
end
|
50
|
-
rules <<
|
53
|
+
rules << "{ #{elements.join(', ')} }"
|
51
54
|
end
|
52
|
-
|
55
|
+
"[#{rules.join(', ')}]"
|
53
56
|
end
|
54
57
|
|
55
58
|
def generate_lifecycle_rule_specs(lifecycle_rule)
|
56
59
|
return [] unless lifecycle_rule
|
60
|
+
|
57
61
|
linespecs = []
|
58
62
|
lifecycle_rule.rules.each do |rule|
|
59
63
|
transitions = generate_lifecycle_rule_transitions_spec(rule.transitions.map(&:to_h))
|
@@ -81,7 +85,7 @@ it do
|
|
81
85
|
end
|
82
86
|
|
83
87
|
def bucket_spec_template
|
84
|
-
|
88
|
+
<<-'EOF'
|
85
89
|
describe s3_bucket('<%= bucket.name %>') do
|
86
90
|
it { should exist }
|
87
91
|
<%- if acl -%>
|
@@ -107,7 +111,6 @@ describe s3_bucket('<%= bucket.name %>') do
|
|
107
111
|
<%- end -%>
|
108
112
|
end
|
109
113
|
EOF
|
110
|
-
template
|
111
114
|
end
|
112
115
|
|
113
116
|
private
|
@@ -1,13 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Awspec::Generator
|
2
4
|
module Spec
|
3
5
|
class SecurityGroup
|
4
6
|
include Awspec::Helper::Finder
|
5
7
|
def generate_by_vpc_id(vpc_id)
|
6
|
-
describes = %w
|
8
|
+
describes = %w[
|
7
9
|
group_id group_name
|
8
|
-
|
10
|
+
]
|
9
11
|
vpc = find_vpc(vpc_id)
|
10
12
|
raise 'Not Found VPC' unless vpc
|
13
|
+
|
11
14
|
@vpc_id = vpc[:vpc_id]
|
12
15
|
@vpc_tag_name = vpc.tag_name
|
13
16
|
sgs = select_security_group_by_vpc_id(@vpc_id)
|
@@ -28,14 +31,14 @@ module Awspec::Generator
|
|
28
31
|
def generate_linespecs(sg)
|
29
32
|
linespecs = []
|
30
33
|
permissions = { 'inbound' => sg.ip_permissions, 'outbound' => sg.ip_permissions_egress }
|
31
|
-
%w
|
34
|
+
%w[inbound outbound].each do |inout|
|
32
35
|
permissions[inout].each do |permission|
|
33
36
|
port = if permission.from_port.nil?
|
34
37
|
nil
|
35
38
|
elsif permission.from_port == permission.to_port
|
36
39
|
permission.from_port
|
37
40
|
else
|
38
|
-
"'
|
41
|
+
"'#{permission.from_port}-#{permission.to_port}'"
|
39
42
|
end
|
40
43
|
|
41
44
|
protocol = if permission.ip_protocol.to_i < 0
|
@@ -59,14 +62,13 @@ module Awspec::Generator
|
|
59
62
|
end
|
60
63
|
|
61
64
|
def security_group_spec_linetemplate
|
62
|
-
|
65
|
+
<<-'EOF'
|
63
66
|
its(:<%= inout %>) { should be_opened<%- unless port.nil? -%>(<%= port %>)<%- end -%>.protocol('<%= protocol %>').for('<%= target %>') }
|
64
67
|
EOF
|
65
|
-
template
|
66
68
|
end
|
67
69
|
|
68
70
|
def security_group_spec_template
|
69
|
-
|
71
|
+
<<-'EOF'
|
70
72
|
describe security_group('<%= sg.group_name %>') do
|
71
73
|
it { should exist }
|
72
74
|
<% describes.each do |describe| %>
|
@@ -88,7 +90,6 @@ describe security_group('<%= sg.group_name %>') do
|
|
88
90
|
<%- end -%>
|
89
91
|
end
|
90
92
|
EOF
|
91
|
-
template
|
92
93
|
end
|
93
94
|
end
|
94
95
|
end
|