awspec 1.17.4 → 1.18.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 24a77e8385426709aab7708405c31a6c44f80043
4
- data.tar.gz: bc25733590d646e87cf24930f3fe9494b8d0fc49
2
+ SHA256:
3
+ metadata.gz: 282551e2308dd0173e1945a36abc52c0f7c5836b9a070a73c071385d268b4c21
4
+ data.tar.gz: bc12a2007ec95614d27b9d963cf204bcc0f10424fe063d620591e5ddf684a84f
5
5
  SHA512:
6
- metadata.gz: 98c3884402e67f7856551ad7945597fe50cb906a39ee00a7b347843127561443a159f24829ec865682b2f11807dbbe85eb06c0ceaaaa1ce54f7a64381d902c64
7
- data.tar.gz: 620fbf415995935dadb197ba200808ed0f8987de02fd2ac7b8be59d1decb2c96f2564b4593198bd1dba718664452c770985f940de2832698adc47261075e2680
6
+ metadata.gz: 05bbe8f18a6d921cfa135a2704a643a8ff6970d1975de78af029e1f93214d3ef6ef19199acccde8bba8535a29bc0b4aee9949287647eeae94d9a957aa2a64c7d
7
+ data.tar.gz: ddf9edd8742c58ffae8a106f1fe86e41dc38aa8fac3a7b31ed0a2826341a8eb916bb8e8673367f8e2d7149b35cb0530eeb0140e7eae68db55b4f7aa0fc9d999d
data/README.md CHANGED
@@ -96,6 +96,33 @@ describe sqs('my-sqs-queue'), region: 'us-west-2' do
96
96
  end
97
97
  ```
98
98
 
99
+ #### Using terraform outputs as identifier
100
+
101
+ Especially in cases, where resources created by terraform have the same names (e.g. created by VPC module), it is helpful to use terraform outputs as unique identifiers.
102
+
103
+ ```terraform
104
+ output "my_ec2_instance" {
105
+ value = aws_instance.my_instance.id
106
+ }
107
+ ```
108
+
109
+ ```ruby
110
+ require 'spec_helper'
111
+
112
+ my_ec2_instance = `terraform output my_ec2_instance`.strip
113
+
114
+ describe ec2(my_ec2_instance) do
115
+ it { should be_running }
116
+ its(:image_id) { should eq 'ami-abc12def' }
117
+ its(:public_ip_address) { should eq '123.0.456.789' }
118
+ it { should have_security_group('my-security-group-name') }
119
+ it { should belong_to_vpc('my-vpc') }
120
+ it { should belong_to_subnet('subnet-1234a567') }
121
+ it { should have_eip('123.0.456.789') }
122
+ it { should be_disabled_api_termination }
123
+ end
124
+ ```
125
+
99
126
  ### STEP 4. Run tests
100
127
  Add gem "rake" in your Gemfile if you are starting a blank project.
101
128
 
@@ -30,6 +30,14 @@ describe alb('my-alb') do
30
30
  end
31
31
  ```
32
32
 
33
+ ### have_tag
34
+
35
+ ```ruby
36
+ describe alb('my-alb') do
37
+ it { should have_tag('environment').value('dev') }
38
+ end
39
+ ```
40
+
33
41
  ### belong_to_vpc
34
42
 
35
43
  ```ruby
@@ -37,3 +37,11 @@ describe cloudtrail('my-trail') do
37
37
  it { should be_logging }
38
38
  end
39
39
  ```
40
+
41
+ ### have_tag
42
+
43
+ ```ruby
44
+ describe cloudtrail('my-trail') do
45
+ it { should have_tag('Name').value('my-trail') }
46
+ end
47
+ ```
@@ -38,3 +38,11 @@ describe cloudwatch_logs('my-cloudwatch-logs-group') do
38
38
  end
39
39
  end
40
40
  ```
41
+
42
+ ### have_tag
43
+
44
+ ```ruby
45
+ describe cloudwatch_logs('my-cloudwatch-logs-group') do
46
+ it { should have_tag('Name').value('my-cloudwatch-logs-group') }
47
+ end
48
+ ```
@@ -0,0 +1,15 @@
1
+ ### exist
2
+
3
+ ```ruby
4
+ describe secretsmanager('my-secret') do
5
+ it { should exist }
6
+ end
7
+ ```
8
+
9
+ ### have_tag
10
+
11
+ ```ruby
12
+ describe secretsmanager('my-secret') do
13
+ it { should have_tag('Name').value('my-secret') }
14
+ end
15
+ ```
@@ -64,6 +64,7 @@
64
64
  | [route53_hosted_zone](#route53_hosted_zone)
65
65
  | [route_table](#route_table)
66
66
  | [s3_bucket](#s3_bucket)
67
+ | [secretsmanager](#secretsmanager)
67
68
  | [security_group](#security_group)
68
69
  | [ses_identity](#ses_identity)
69
70
  | [sns_topic](#sns_topic)
@@ -144,6 +145,15 @@ end
144
145
  ```
145
146
 
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
+
147
157
  ### belong_to_vpc
148
158
 
149
159
  ```ruby
@@ -274,7 +284,7 @@ describe apigateway('my-apigateway') do
274
284
  end
275
285
  ```
276
286
 
277
- ### 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)
287
+ ### its(:id), its(:name), its(:description), its(:created_date), its(:version), its(:warnings), its(:binary_media_types), its(:minimum_compression_size), its(:api_key_source), its(:policy), its(:tags)
278
288
  ## <a name="autoscaling_group">autoscaling_group</a>
279
289
 
280
290
  AutoscalingGroup resource type.
@@ -506,7 +516,7 @@ describe cloudfront_distribution('123456789zyxw.cloudfront.net') do
506
516
  end
507
517
  ```
508
518
 
509
- ### 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)
519
+ ### its(:id), its(:arn), its(:status), its(:last_modified_time), its(:domain_name), its(:origin_groups), its(:comment), its(:price_class), its(:enabled), its(:web_acl_id), its(:http_version), its(:is_ipv6_enabled), its(:alias_icp_recordals)
510
520
  ## <a name="cloudtrail">cloudtrail</a>
511
521
 
512
522
  Cloudtrail resource type.
@@ -528,6 +538,7 @@ describe cloudtrail('my-trail') do
528
538
  end
529
539
  ```
530
540
 
541
+
531
542
  ### be_multi_region_trail
532
543
 
533
544
  ```ruby
@@ -555,6 +566,14 @@ end
555
566
  ```
556
567
 
557
568
 
569
+ ### have_tag
570
+
571
+ ```ruby
572
+ describe cloudtrail('my-trail') do
573
+ it { should have_tag('Name').value('my-trail') }
574
+ end
575
+ ```
576
+
558
577
  ### its(:name), its(:s3_bucket_name), its(:s3_key_prefix), its(:sns_topic_name), its(:sns_topic_arn), its(:include_global_service_events), its(:is_multi_region_trail), its(:home_region), its(:trail_arn), its(:log_file_validation_enabled), its(:cloud_watch_logs_log_group_arn), its(:cloud_watch_logs_role_arn), its(:kms_key_id), its(:has_custom_event_selectors), its(:is_organization_trail)
559
578
  ## <a name="cloudwatch_alarm">cloudwatch_alarm</a>
560
579
 
@@ -604,7 +623,7 @@ describe cloudwatch_alarm('my-cloudwatch-alarm') do
604
623
  end
605
624
  ```
606
625
 
607
- ### 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)
626
+ ### its(:alarm_name), its(:alarm_arn), its(:alarm_description), its(:alarm_configuration_updated_timestamp), its(:actions_enabled), its(:ok_actions), its(:alarm_actions), its(:insufficient_data_actions), its(:state_value), its(:state_reason), its(:state_reason_data), its(:state_updated_timestamp), its(:metric_name), its(:namespace), its(:statistic), its(:extended_statistic), its(:period), its(:unit), its(:evaluation_periods), its(:datapoints_to_alarm), its(:threshold), its(:comparison_operator), its(:treat_missing_data), its(:evaluate_low_sample_count_percentile), its(:metrics), its(:threshold_metric_id)
608
627
  ## <a name="cloudwatch_event">cloudwatch_event</a>
609
628
 
610
629
  CloudwatchEvent resource type.
@@ -615,7 +634,7 @@ CloudwatchEvent resource type.
615
634
 
616
635
  ### be_scheduled
617
636
 
618
- ### its(:name), its(:arn), its(:event_pattern), its(:state), its(:description), its(:schedule_expression), its(:role_arn), its(:managed_by)
637
+ ### its(:name), its(:arn), its(:event_pattern), its(:state), its(:description), its(:schedule_expression), its(:role_arn), its(:managed_by), its(:event_bus_name)
619
638
  ## <a name="cloudwatch_logs">cloudwatch_logs</a>
620
639
 
621
640
  CloudwatchLogs resource type.
@@ -664,6 +683,15 @@ describe cloudwatch_logs('my-cloudwatch-logs-group') do
664
683
  end
665
684
  ```
666
685
 
686
+
687
+ ### have_tag
688
+
689
+ ```ruby
690
+ describe cloudwatch_logs('my-cloudwatch-logs-group') do
691
+ it { should have_tag('Name').value('my-cloudwatch-logs-group') }
692
+ end
693
+ ```
694
+
667
695
  ### its(:log_group_name), its(:creation_time), its(:retention_in_days), its(:metric_filter_count), its(:arn), its(:stored_bytes), its(:kms_key_id)
668
696
  ## <a name="codebuild">codebuild</a>
669
697
 
@@ -734,7 +762,7 @@ end
734
762
  ```
735
763
 
736
764
 
737
- ### its(:bgp_asn), its(:customer_gateway_id), its(:ip_address), its(:state), its(:type), its(:tags)
765
+ ### its(:bgp_asn), its(:customer_gateway_id), its(:ip_address), its(:certificate_arn), its(:state), its(:type), its(:tags)
738
766
  ## <a name="directconnect_virtual_interface">directconnect_virtual_interface</a>
739
767
 
740
768
  DirectconnectVirtualInterface resource type.
@@ -770,7 +798,7 @@ describe directconnect_virtual_interface('my-directconnect-virtual-interface') d
770
798
  end
771
799
  ```
772
800
 
773
- ### 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)
801
+ ### its(:owner_account), its(:virtual_interface_id), its(:location), its(:connection_id), its(:virtual_interface_type), its(:virtual_interface_name), its(:vlan), its(:asn), its(:amazon_side_asn), its(:auth_key), its(:amazon_address), its(:customer_address), its(:address_family), its(:virtual_interface_state), its(:customer_router_config), its(:mtu), its(:jumbo_frame_capable), its(:virtual_gateway_id), its(:direct_connect_gateway_id), its(:route_filter_prefixes), its(:bgp_peers), its(:region), its(:aws_device_v2), its(:tags)
774
802
  ## <a name="dynamodb_table">dynamodb_table</a>
775
803
 
776
804
  DynamodbTable resource type.
@@ -1148,7 +1176,7 @@ describe ecs_cluster('my-ecs-cluster') do
1148
1176
  end
1149
1177
  ```
1150
1178
 
1151
- ### 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)
1179
+ ### its(:cluster_arn), its(:cluster_name), its(:status), its(:registered_container_instances_count), its(:running_tasks_count), its(:pending_tasks_count), its(:active_services_count), its(:statistics), its(:tags), its(:settings)
1152
1180
  ## <a name="ecs_container_instance">ecs_container_instance</a>
1153
1181
 
1154
1182
  ECS Container Instance resource type.
@@ -1173,7 +1201,7 @@ end
1173
1201
  ```
1174
1202
 
1175
1203
 
1176
- ### its(:container_instance_arn), its(:ec2_instance_id), its(:version), its(:version_info), its(:status), its(:agent_connected), its(:running_tasks_count), its(:pending_tasks_count), its(:agent_update_status), its(:attributes), its(:registered_at), its(:attachments), its(:tags)
1204
+ ### its(:container_instance_arn), its(:ec2_instance_id), 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)
1177
1205
  ## <a name="ecs_service">ecs_service</a>
1178
1206
 
1179
1207
  ECS Service resource type.
@@ -2268,7 +2296,7 @@ describe mq('my-mq') do
2268
2296
  end
2269
2297
  ```
2270
2298
 
2271
- ### 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(:engine_type), its(:engine_version), its(:host_instance_type), its(:pending_engine_version), its(:publicly_accessible), its(:security_groups), its(:subnet_ids)
2299
+ ### its(:vpc_id), its(:auto_minor_version_upgrade), its(:broker_arn), its(:broker_id), its(:broker_name), its(:broker_state), its(:created), its(:deployment_mode), its(:encryption_options), its(:engine_type), its(:engine_version), its(:host_instance_type), its(:pending_engine_version), its(:publicly_accessible), its(:security_groups), its(:subnet_ids)
2272
2300
  ## <a name="nat_gateway">nat_gateway</a>
2273
2301
 
2274
2302
  NatGateway resource type.
@@ -2696,7 +2724,7 @@ end
2696
2724
  ```
2697
2725
 
2698
2726
 
2699
- ### 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)
2727
+ ### its(:vpc_id), its(:db_instance_identifier), its(:db_instance_class), its(:engine), its(:db_instance_status), its(:master_username), its(:db_name), its(:endpoint), its(:allocated_storage), its(:instance_create_time), its(:preferred_backup_window), its(:backup_retention_period), its(:db_security_groups), its(:availability_zone), its(:preferred_maintenance_window), its(:pending_modified_values), its(:latest_restorable_time), its(:multi_az), its(:engine_version), its(:auto_minor_version_upgrade), its(:read_replica_source_db_instance_identifier), its(:read_replica_db_instance_identifiers), its(:read_replica_db_cluster_identifiers), its(:license_model), its(:iops), its(:character_set_name), its(:secondary_availability_zone), its(:publicly_accessible), its(:status_infos), its(:storage_type), its(:tde_credential_arn), its(:db_instance_port), its(:db_cluster_identifier), its(:storage_encrypted), its(:kms_key_id), its(:dbi_resource_id), its(:ca_certificate_identifier), its(:domain_memberships), its(:copy_tags_to_snapshot), its(:monitoring_interval), its(:enhanced_monitoring_resource_arn), its(:monitoring_role_arn), its(:promotion_tier), its(:db_instance_arn), its(:timezone), its(:iam_database_authentication_enabled), its(:performance_insights_enabled), its(:performance_insights_kms_key_id), its(:performance_insights_retention_period), its(:enabled_cloudwatch_logs_exports), its(:processor_features), its(:deletion_protection), its(:associated_roles), its(:listener_endpoint), its(:max_allocated_storage)
2700
2728
  ### :unlock: Advanced use
2701
2729
 
2702
2730
  `rds` can use `Aws::RDS::DBInstance` resource (see http://docs.aws.amazon.com/sdkforruby/api/Aws/RDS/DBInstance.html).
@@ -2828,7 +2856,7 @@ describe redshift('my-redshift') do
2828
2856
  end
2829
2857
  ```
2830
2858
 
2831
- ### its(:vpc_id), its(:cluster_identifier), its(:node_type), its(:cluster_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(:resize_info)
2859
+ ### its(:vpc_id), its(:cluster_identifier), its(:node_type), its(:cluster_status), its(:cluster_availability_status), its(:modify_status), its(:master_username), its(:db_name), its(:endpoint), its(:cluster_create_time), its(:automated_snapshot_retention_period), its(:manual_snapshot_retention_period), its(:cluster_security_groups), its(:cluster_subnet_group_name), its(:vpc_id), its(:availability_zone), its(:preferred_maintenance_window), its(:pending_modified_values), its(:cluster_version), its(:allow_version_upgrade), its(:number_of_nodes), its(:publicly_accessible), its(:encrypted), its(:restore_status), its(:data_transfer_progress), its(:hsm_status), its(:cluster_snapshot_copy_status), its(:cluster_public_key), its(:cluster_nodes), its(:elastic_ip_status), its(:cluster_revision_number), its(:kms_key_id), its(:enhanced_vpc_routing), its(:iam_roles), its(:pending_actions), its(:maintenance_track_name), its(:elastic_resize_number_of_node_options), its(:deferred_maintenance_windows), its(:snapshot_schedule_identifier), its(:snapshot_schedule_state), its(:expected_next_snapshot_schedule_time), its(:expected_next_snapshot_schedule_time_status), its(:resize_info)
2832
2860
  ## <a name="redshift_cluster_parameter_group">redshift_cluster_parameter_group</a>
2833
2861
 
2834
2862
  RedshiftClusterParameterGroup resource type.
@@ -3123,6 +3151,28 @@ describe s3_bucket('my-bucket') do
3123
3151
  end
3124
3152
  ```
3125
3153
 
3154
+ ## <a name="secretsmanager">secretsmanager</a>
3155
+
3156
+ Secretsmanager resource type.
3157
+
3158
+ ### exist
3159
+
3160
+ ```ruby
3161
+ describe secretsmanager('my-secret') do
3162
+ it { should exist }
3163
+ end
3164
+ ```
3165
+
3166
+
3167
+ ### have_tag
3168
+
3169
+ ```ruby
3170
+ describe secretsmanager('my-secret') do
3171
+ it { should have_tag('Name').value('my-secret') }
3172
+ end
3173
+ ```
3174
+
3175
+ ### its(:arn), its(:name), its(:description), its(:kms_key_id), its(:rotation_enabled), its(:rotation_lambda_arn), its(:last_rotated_date), its(:last_changed_date), its(:last_accessed_date), its(:deleted_date), its(:owning_service)
3126
3176
  ## <a name="security_group">security_group</a>
3127
3177
 
3128
3178
  SecurityGroup resource type.
@@ -9,7 +9,8 @@ module Awspec::Generator
9
9
  @ret = @type.resource_via_client
10
10
  @matchers = [
11
11
  Awspec::Type::Alb::STATES.map { |state| 'be_' + state }.join(', '),
12
- 'belong_to_vpc'
12
+ 'belong_to_vpc',
13
+ # 'have_tag'
13
14
  ]
14
15
  @ignore_matchers = Awspec::Type::Alb::STATES.map { |state| 'be_' + state }
15
16
  @describes = []
@@ -0,0 +1,17 @@
1
+ module Awspec::Generator
2
+ module Doc
3
+ module Type
4
+ class Secretsmanager < Base
5
+ def initialize
6
+ super
7
+ @type_name = 'Secretsmanager'
8
+ @type = Awspec::Type::Secretsmanager.new('my-secret')
9
+ @ret = @type.resource_via_client
10
+ @matchers = []
11
+ @ignore_matchers = []
12
+ @describes = []
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -46,6 +46,7 @@ require 'awspec/helper/finder/emr'
46
46
  require 'awspec/helper/finder/redshift'
47
47
  require 'awspec/helper/finder/codedeploy'
48
48
  require 'awspec/helper/finder/mq'
49
+ require 'awspec/helper/finder/secretsmanager'
49
50
 
50
51
  require 'awspec/helper/finder/account_attributes'
51
52
 
@@ -101,6 +102,7 @@ module Awspec::Helper
101
102
  include Awspec::Helper::Finder::Redshift
102
103
  include Awspec::Helper::Finder::Codedeploy
103
104
  include Awspec::Helper::Finder::Mq
105
+ include Awspec::Helper::Finder::Secretsmanager
104
106
 
105
107
  CLIENTS = {
106
108
  ec2_client: Aws::EC2::Client,
@@ -144,7 +146,8 @@ module Awspec::Helper
144
146
  emr_client: Aws::EMR::Client,
145
147
  redshift_client: Aws::Redshift::Client,
146
148
  codedeploy_client: Aws::CodeDeploy::Client,
147
- mq_client: Aws::MQ::Client
149
+ mq_client: Aws::MQ::Client,
150
+ secretsmanager_client: Aws::SecretsManager::Client
148
151
  }
149
152
 
150
153
  CLIENT_OPTIONS = {
@@ -54,6 +54,15 @@ module Awspec::Helper
54
54
  end
55
55
  selected
56
56
  end
57
+
58
+ def select_all_alb_tags(id)
59
+ res = elbv2_client.describe_tags({ resource_arns: [id] })
60
+ res.tag_descriptions.select do |resource|
61
+ resource.resource_arn == id
62
+ end.first.tags
63
+ rescue
64
+ return nil
65
+ end
57
66
  end
58
67
  end
59
68
  end
@@ -15,6 +15,12 @@ module Awspec::Helper
15
15
  cloudtrail_client.get_trail_status(name: id)
16
16
  end
17
17
 
18
+ def get_trail_tags(arn)
19
+ cloudtrail_client.list_tags(
20
+ resource_id_list: [arn]
21
+ )[:resource_tag_list].first[:tags_list]
22
+ end
23
+
18
24
  def is_logging?(id)
19
25
  ret = get_trail_status(id).is_logging
20
26
  end
@@ -64,6 +64,10 @@ module Awspec::Helper
64
64
  log_groups
65
65
  end
66
66
 
67
+ def find_tags_by_log_group_name(id)
68
+ cloudwatch_logs_client.list_tags_log_group(log_group_name: id)[:tags]
69
+ end
70
+
67
71
  filter_types = %w(metric subscription)
68
72
  filter_types.each do |type|
69
73
  define_method 'select_all_cloudwatch_logs_' + type + '_filter' do |*args|
@@ -23,7 +23,7 @@ module Awspec::Helper
23
23
  end
24
24
 
25
25
  def select_all_lambda_functions
26
- res = lambda_client.list_functions.map do |response|
26
+ lambda_client.list_functions.map do |response|
27
27
  response.functions
28
28
  end.flatten
29
29
  end
@@ -13,6 +13,16 @@ module Awspec::Helper
13
13
  nil
14
14
  end
15
15
 
16
+ def head_object(id, key)
17
+ res = s3_client.head_object({
18
+ bucket: id,
19
+ key: key.sub(%r(\A/), '')
20
+ })
21
+ res.data.class == Aws::S3::Types::HeadObjectOutput
22
+ rescue Aws::S3::Errors::NotFound
23
+ false
24
+ end
25
+
16
26
  def find_bucket_cors(id)
17
27
  s3_client.get_bucket_cors(bucket: id)
18
28
  rescue Aws::S3::Errors::ServiceError
@@ -0,0 +1,11 @@
1
+ module Awspec::Helper
2
+ module Finder
3
+ module Secretsmanager
4
+ def find_secret(id)
5
+ secretsmanager_client.describe_secret({
6
+ secret_id: id
7
+ })
8
+ end
9
+ end
10
+ end
11
+ end
@@ -20,6 +20,7 @@ module Awspec
20
20
  elastictranscoder_pipeline waf_web_acl wafregional_web_acl customer_gateway vpn_gateway vpn_connection
21
21
  internet_gateway acm cloudwatch_logs dynamodb_table eip sqs ssm_parameter cloudformation_stack
22
22
  codebuild sns_topic redshift redshift_cluster_parameter_group codedeploy codedeploy_deployment_group
23
+ secretsmanager
23
24
  )
24
25
 
25
26
  ACCOUNT_ATTRIBUTES = %w(
@@ -81,6 +81,15 @@ Aws.config[:elasticloadbalancingv2] = {
81
81
  protocol: 'HTTP'
82
82
  }
83
83
  ]
84
+ },
85
+ describe_tags: {
86
+ tag_descriptions: [
87
+ resource_arn: 'arn:aws:elasticloadbalancing:ap-northeast-1:1234567890:loadbalancer/app/my-alb/1aa1bb1cc1ddee11',
88
+ tags: [
89
+ key: 'environment',
90
+ value: 'dev'
91
+ ]
92
+ ]
84
93
  }
85
94
  }
86
95
  }
@@ -6,12 +6,30 @@ Aws.config[:cloudtrail] = {
6
6
  name: 'my-trail',
7
7
  include_global_service_events: true,
8
8
  is_multi_region_trail: true,
9
- log_file_validation_enabled: true
9
+ log_file_validation_enabled: true,
10
+ trail_arn: 'my-trail-arn'
10
11
  }
11
12
  ]
12
13
  },
13
14
  get_trail_status: {
14
15
  is_logging: true
16
+ },
17
+ list_tags: {
18
+ resource_tag_list: [
19
+ {
20
+ resource_id: 'my-trail-arn',
21
+ tags_list: [
22
+ {
23
+ key: 'key_one',
24
+ value: 'value_one'
25
+ },
26
+ {
27
+ key: 'key_two',
28
+ value: 'value_two'
29
+ }
30
+ ]
31
+ }
32
+ ]
15
33
  }
16
34
  }
17
35
  }
@@ -29,6 +29,13 @@ Aws.config[:cloudwatchlogs] = {
29
29
  filter_pattern: '[host, ident, authuser, date, request, status, bytes]'
30
30
  }
31
31
  ]
32
+ },
33
+ list_tags_log_group: {
34
+ tags: {
35
+ 'key_one' => 'value_one',
36
+ 'key_two' => 'value_two'
37
+ }
32
38
  }
39
+
33
40
  }
34
41
  }
@@ -0,0 +1,36 @@
1
+ Aws.config[:secretsmanager] = {
2
+ stub_responses: {
3
+ describe_secret: {
4
+ arn: 'my-secret-arn',
5
+ description: 'my secret description',
6
+ kms_key_id: 'secret-kms-key-arn',
7
+ last_accessed_date: Time.at(1_523_923_200),
8
+ last_changed_date: Time.at(1_523_477_145.729),
9
+ last_rotated_date: Time.at(1_525_747_253.72),
10
+ name: 'my-secret-name',
11
+ rotation_enabled: true,
12
+ rotation_lambda_arn: 'my-secret-rotation-lambda-arn',
13
+ rotation_rules: {
14
+ automatically_after_days: 30
15
+ },
16
+ tags: [
17
+ {
18
+ key: 'key_one',
19
+ value: 'value_one'
20
+ },
21
+ {
22
+ key: 'key_two',
23
+ value: 'value_two'
24
+ }
25
+ ],
26
+ version_ids_to_stages: {
27
+ 'EXAMPLE1-90ab-cdef-fedc-ba987EXAMPLE' => [
28
+ 'AWSPREVIOUS'
29
+ ],
30
+ 'EXAMPLE2-90ab-cdef-fedc-ba987EXAMPLE' => [
31
+ 'AWSCURRENT'
32
+ ]
33
+ }
34
+ }
35
+ }
36
+ }
@@ -1,5 +1,6 @@
1
1
  module Awspec::Type
2
2
  class Alb < ResourceBase
3
+ tags_allowed
3
4
  def resource_via_client
4
5
  @resource_via_client ||= find_alb(@display_name)
5
6
  end
@@ -38,5 +39,13 @@ module Awspec::Type
38
39
  subnet2 = find_subnet(subnet_id)
39
40
  subnet2.subnet_id = subnet_id
40
41
  end
42
+
43
+ def has_tag?(tag_key, tag_value)
44
+ alb_arn = resource_via_client.load_balancer_arn
45
+ tag_set = select_all_alb_tags(alb_arn)
46
+ tag_set.find do |tag|
47
+ tag.key == tag_key && tag.value == tag_value
48
+ end
49
+ end
41
50
  end
42
51
  end
@@ -25,5 +25,11 @@ module Awspec::Type
25
25
  def logging?
26
26
  is_logging?(id)
27
27
  end
28
+
29
+ def has_tag?(tag_key, tag_value)
30
+ get_trail_tags(resource_via_client.trail_arn).find do |tag|
31
+ tag.key == tag_key && tag.value == tag_value
32
+ end
33
+ end
28
34
  end
29
35
  end
@@ -27,5 +27,11 @@ module Awspec::Type
27
27
  end
28
28
  return true if ret.filter_name == filter_name
29
29
  end
30
+
31
+ def has_tag?(tag_key, tag_value)
32
+ find_tags_by_log_group_name(resource_via_client.log_group_name).find do |key, value|
33
+ key == tag_key && value == tag_value
34
+ end
35
+ end
30
36
  end
31
37
  end
@@ -90,7 +90,7 @@ module Awspec::Type
90
90
  def has_network_interface?(network_interface_id, device_index = nil)
91
91
  res = find_network_interface(network_interface_id)
92
92
  interfaces = resource_via_client.network_interfaces
93
- ret = interfaces.find do |interface|
93
+ interfaces.find do |interface|
94
94
  next false if device_index && interface.attachment.device_index != device_index
95
95
  interface.network_interface_id == res.network_interface_id
96
96
  end
@@ -98,7 +98,7 @@ module Awspec::Type
98
98
 
99
99
  def has_event?(event_code)
100
100
  status = find_ec2_status(id)
101
- ret = status.events.find do |event|
101
+ status.events.find do |event|
102
102
  event.code == event_code
103
103
  end
104
104
  end
@@ -54,7 +54,8 @@ module Awspec::Type
54
54
  cgw = find_customer_gateway(gateway_id)
55
55
  return true if cgw && cgw.customer_gateway_id == route.gateway_id
56
56
  # nat gateway
57
- return true if route.nat_gateway_id == gateway_id
57
+ nat = find_nat_gateway(gateway_id)
58
+ return true if nat.nat_gateway_id == route.nat_gateway_id
58
59
  false
59
60
  end
60
61
 
@@ -68,7 +69,8 @@ module Awspec::Type
68
69
 
69
70
  def target_nat?(route, nat_gateway_id)
70
71
  # nat
71
- route.nat_gateway_id == nat_gateway_id
72
+ nat = find_nat_gateway(nat_gateway_id)
73
+ nat.nat_gateway_id == route.nat_gateway_id
72
74
  end
73
75
 
74
76
  def target_vpc_peering_connection?(route, vpc_peering_connection_id)
@@ -11,16 +11,12 @@ module Awspec::Type
11
11
  end
12
12
 
13
13
  def has_object?(key)
14
- res = s3_client.head_object({
15
- bucket: id,
16
- key: key.sub(%r(\A/), '')
17
- })
18
- res
19
- rescue
20
- false
14
+ check_existence
15
+ head_object(id, key)
21
16
  end
22
17
 
23
18
  def has_acl_grant?(grantee:, permission:)
19
+ check_existence
24
20
  @acl = find_bucket_acl(id)
25
21
  @acl.grants.find do |grant|
26
22
  grant.permission == permission &&
@@ -29,11 +25,13 @@ module Awspec::Type
29
25
  end
30
26
 
31
27
  def acl_owner
28
+ check_existence
32
29
  @acl = find_bucket_acl(id)
33
30
  @acl.owner.display_name
34
31
  end
35
32
 
36
33
  def acl_grants_count
34
+ check_existence
37
35
  @acl = find_bucket_acl(id)
38
36
  @acl.grants.count
39
37
  end
@@ -57,7 +55,9 @@ module Awspec::Type
57
55
  end
58
56
 
59
57
  def has_policy?(policy)
58
+ check_existence
60
59
  bp = find_bucket_policy(id)
60
+
61
61
  if bp
62
62
  JSON.parse(bp.policy.read, array_class: Set) == JSON.parse(policy, array_class: Set)
63
63
  else
@@ -66,12 +66,14 @@ module Awspec::Type
66
66
  end
67
67
 
68
68
  def has_tag?(key, value)
69
+ check_existence
69
70
  tag = find_bucket_tag(id, key)
70
71
  return nil if tag.value != value
71
72
  tag
72
73
  end
73
74
 
74
75
  def has_logging_enabled?(target_bucket: nil, target_prefix: nil)
76
+ check_existence
75
77
  bl = find_bucket_logging(id)
76
78
  le = bl ? bl.logging_enabled : nil
77
79
 
@@ -82,11 +84,13 @@ module Awspec::Type
82
84
  end
83
85
 
84
86
  def has_versioning_enabled?
87
+ check_existence
85
88
  bv = find_bucket_versioning(id)
86
89
  bv ? (bv.status == 'Enabled') : false
87
90
  end
88
91
 
89
92
  def has_lifecycle_rule?(rule)
93
+ check_existence
90
94
  lc_rule = lifecycle_configuration_rules.select { |r| r[:id] == rule[:id] }
91
95
  return false if lc_rule == []
92
96
 
@@ -105,11 +109,13 @@ module Awspec::Type
105
109
  end
106
110
 
107
111
  def has_mfa_delete_enabled?
112
+ check_existence
108
113
  bv = find_bucket_versioning(id)
109
114
  bv ? (bv.mfa_delete == 'Enabled') : false
110
115
  end
111
116
 
112
117
  def has_server_side_encryption?(algorithm:)
118
+ check_existence
113
119
  configuration = find_bucket_server_side_encryption(id)
114
120
  return false unless configuration
115
121
 
@@ -120,8 +126,9 @@ module Awspec::Type
120
126
  private
121
127
 
122
128
  def cors_rules
123
- cors = find_bucket_cors(id)
124
- cors ? cors.cors_rules : []
129
+ check_existence
130
+ @cors ||= find_bucket_cors(id)
131
+ @cors ? @cors.cors_rules : []
125
132
  end
126
133
 
127
134
  def lifecycle_configuration_rules
@@ -0,0 +1,14 @@
1
+ module Awspec::Type
2
+ class Secretsmanager < ResourceBase
3
+ aws_resource Aws::SecretsManager
4
+ tags_allowed
5
+
6
+ def resource_via_client
7
+ @resource_via_client ||= find_secret(@display_name)
8
+ end
9
+
10
+ def id
11
+ @id ||= resource_via_client.name if resource_via_client
12
+ end
13
+ end
14
+ end
@@ -1,3 +1,3 @@
1
1
  module Awspec
2
- VERSION = '1.17.4'
2
+ VERSION = '1.18.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: awspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.17.4
4
+ version: 1.18.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - k1LoW
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-05-17 00:00:00.000000000 Z
11
+ date: 2019-08-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk
@@ -207,7 +207,6 @@ extensions: []
207
207
  extra_rdoc_files: []
208
208
  files:
209
209
  - ".editorconfig"
210
- - ".gitignore"
211
210
  - ".rubocop.yml"
212
211
  - ".tachikoma.yml"
213
212
  - ".travis.yml"
@@ -285,6 +284,7 @@ files:
285
284
  - doc/_resource_types/route53_hosted_zone.md
286
285
  - doc/_resource_types/route_table.md
287
286
  - doc/_resource_types/s3_bucket.md
287
+ - doc/_resource_types/secretsmanager.md
288
288
  - doc/_resource_types/security_group.md
289
289
  - doc/_resource_types/ses_identity.md
290
290
  - doc/_resource_types/ses_send_quota.md
@@ -382,6 +382,7 @@ files:
382
382
  - lib/awspec/generator/doc/type/route53_hosted_zone.rb
383
383
  - lib/awspec/generator/doc/type/route_table.rb
384
384
  - lib/awspec/generator/doc/type/s3_bucket.rb
385
+ - lib/awspec/generator/doc/type/secretsmanager.rb
385
386
  - lib/awspec/generator/doc/type/security_group.rb
386
387
  - lib/awspec/generator/doc/type/ses_identity.rb
387
388
  - lib/awspec/generator/doc/type/ses_send_quota.rb
@@ -476,6 +477,7 @@ files:
476
477
  - lib/awspec/helper/finder/redshift.rb
477
478
  - lib/awspec/helper/finder/route53.rb
478
479
  - lib/awspec/helper/finder/s3.rb
480
+ - lib/awspec/helper/finder/secretsmanager.rb
479
481
  - lib/awspec/helper/finder/security_group.rb
480
482
  - lib/awspec/helper/finder/ses.rb
481
483
  - lib/awspec/helper/finder/sns_topic.rb
@@ -599,6 +601,7 @@ files:
599
601
  - lib/awspec/stub/route53_hosted_zone.rb
600
602
  - lib/awspec/stub/route_table.rb
601
603
  - lib/awspec/stub/s3_bucket.rb
604
+ - lib/awspec/stub/secretsmanager.rb
602
605
  - lib/awspec/stub/security_group.rb
603
606
  - lib/awspec/stub/ses_identity.rb
604
607
  - lib/awspec/stub/sns_topic.rb
@@ -683,6 +686,7 @@ files:
683
686
  - lib/awspec/type/route53_hosted_zone.rb
684
687
  - lib/awspec/type/route_table.rb
685
688
  - lib/awspec/type/s3_bucket.rb
689
+ - lib/awspec/type/secretsmanager.rb
686
690
  - lib/awspec/type/security_group.rb
687
691
  - lib/awspec/type/ses_identity.rb
688
692
  - lib/awspec/type/ses_send_quota.rb
@@ -716,7 +720,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
716
720
  version: '0'
717
721
  requirements: []
718
722
  rubyforge_project:
719
- rubygems_version: 2.6.14
723
+ rubygems_version: 2.7.6
720
724
  signing_key:
721
725
  specification_version: 4
722
726
  summary: RSpec tests for your AWS resources.
data/.gitignore DELETED
@@ -1,12 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /_yardoc/
5
- /coverage/
6
- /pkg/
7
- /spec/reports/
8
- /tmp/
9
- /spec/secrets.yml
10
- /.ruby-version
11
- *.sw*
12
- *.gem