aws-insight 0.14.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.rspec +2 -0
- data/.rubocop.yml +84 -0
- data/.travis.yml +19 -0
- data/CHANGELOG.md +336 -0
- data/CODE_OF_CONDUCT.md +13 -0
- data/CONTRIBUTING.md +62 -0
- data/Gemfile +19 -0
- data/Guardfile +12 -0
- data/LICENSE +22 -0
- data/README.md +393 -0
- data/Rakefile +6 -0
- data/bin/terraforming +5 -0
- data/contrib/zsh-completion/_terraforming +65 -0
- data/lib/terraforming.rb +54 -0
- data/lib/terraforming/cli.rb +340 -0
- data/lib/terraforming/resource/alb.rb +98 -0
- data/lib/terraforming/resource/auto_scaling_group.rb +90 -0
- data/lib/terraforming/resource/cloud_watch_alarm.rb +87 -0
- data/lib/terraforming/resource/config.rb +98 -0
- data/lib/terraforming/resource/db_parameter_group.rb +58 -0
- data/lib/terraforming/resource/db_security_group.rb +57 -0
- data/lib/terraforming/resource/db_subnet_group.rb +52 -0
- data/lib/terraforming/resource/ec2.rb +130 -0
- data/lib/terraforming/resource/efs_file_system.rb +60 -0
- data/lib/terraforming/resource/eip.rb +66 -0
- data/lib/terraforming/resource/elasti_cache_cluster.rb +80 -0
- data/lib/terraforming/resource/elasti_cache_subnet_group.rb +56 -0
- data/lib/terraforming/resource/elb.rb +203 -0
- data/lib/terraforming/resource/iam_group.rb +54 -0
- data/lib/terraforming/resource/iam_group_membership.rb +63 -0
- data/lib/terraforming/resource/iam_group_policy.rb +71 -0
- data/lib/terraforming/resource/iam_instance_profile.rb +54 -0
- data/lib/terraforming/resource/iam_policy.rb +63 -0
- data/lib/terraforming/resource/iam_policy_attachment.rb +86 -0
- data/lib/terraforming/resource/iam_role.rb +56 -0
- data/lib/terraforming/resource/iam_role_policy.rb +71 -0
- data/lib/terraforming/resource/iam_user.rb +55 -0
- data/lib/terraforming/resource/iam_user_policy.rb +71 -0
- data/lib/terraforming/resource/internet_gateway.rb +54 -0
- data/lib/terraforming/resource/kms_alias.rb +55 -0
- data/lib/terraforming/resource/kms_key.rb +84 -0
- data/lib/terraforming/resource/launch_configuration.rb +106 -0
- data/lib/terraforming/resource/nat_gateway.rb +57 -0
- data/lib/terraforming/resource/network_acl.rb +83 -0
- data/lib/terraforming/resource/network_interface.rb +68 -0
- data/lib/terraforming/resource/rds.rb +74 -0
- data/lib/terraforming/resource/redshift.rb +67 -0
- data/lib/terraforming/resource/route53_record.rb +106 -0
- data/lib/terraforming/resource/route53_zone.rb +89 -0
- data/lib/terraforming/resource/route_table.rb +122 -0
- data/lib/terraforming/resource/route_table_association.rb +59 -0
- data/lib/terraforming/resource/s3.rb +69 -0
- data/lib/terraforming/resource/security_group.rb +188 -0
- data/lib/terraforming/resource/sns_topic.rb +75 -0
- data/lib/terraforming/resource/sns_topic_subscription.rb +83 -0
- data/lib/terraforming/resource/sqs.rb +70 -0
- data/lib/terraforming/resource/subnet.rb +55 -0
- data/lib/terraforming/resource/vpc.rb +67 -0
- data/lib/terraforming/resource/vpn_gateway.rb +55 -0
- data/lib/terraforming/template/tf/alb.erb +28 -0
- data/lib/terraforming/template/tf/auto_scaling_group.erb +28 -0
- data/lib/terraforming/template/tf/cloud_watch_alarm.erb +33 -0
- data/lib/terraforming/template/tf/db_parameter_group.erb +17 -0
- data/lib/terraforming/template/tf/db_security_group.erb +26 -0
- data/lib/terraforming/template/tf/db_subnet_group.erb +8 -0
- data/lib/terraforming/template/tf/ec2.erb +56 -0
- data/lib/terraforming/template/tf/eip.erb +11 -0
- data/lib/terraforming/template/tf/elasti_cache_cluster.erb +22 -0
- data/lib/terraforming/template/tf/elasti_cache_subnet_group.erb +8 -0
- data/lib/terraforming/template/tf/elastic_filesystem.erb +18 -0
- data/lib/terraforming/template/tf/elb.erb +51 -0
- data/lib/terraforming/template/tf/iam_group.erb +7 -0
- data/lib/terraforming/template/tf/iam_group_membership.erb +8 -0
- data/lib/terraforming/template/tf/iam_group_policy.erb +10 -0
- data/lib/terraforming/template/tf/iam_instance_profile.erb +8 -0
- data/lib/terraforming/template/tf/iam_policy.erb +12 -0
- data/lib/terraforming/template/tf/iam_policy_attachment.erb +10 -0
- data/lib/terraforming/template/tf/iam_role.erb +10 -0
- data/lib/terraforming/template/tf/iam_role_policy.erb +10 -0
- data/lib/terraforming/template/tf/iam_user.erb +7 -0
- data/lib/terraforming/template/tf/iam_user_policy.erb +10 -0
- data/lib/terraforming/template/tf/internet_gateway.erb +14 -0
- data/lib/terraforming/template/tf/kms_alias.erb +7 -0
- data/lib/terraforming/template/tf/kms_key.erb +13 -0
- data/lib/terraforming/template/tf/launch_configuration.erb +68 -0
- data/lib/terraforming/template/tf/nat_gateway.erb +9 -0
- data/lib/terraforming/template/tf/network_acl.erb +43 -0
- data/lib/terraforming/template/tf/network_interface.erb +22 -0
- data/lib/terraforming/template/tf/rds.erb +25 -0
- data/lib/terraforming/template/tf/redshift.erb +23 -0
- data/lib/terraforming/template/tf/route53_record.erb +52 -0
- data/lib/terraforming/template/tf/route53_zone.erb +18 -0
- data/lib/terraforming/template/tf/route_table.erb +34 -0
- data/lib/terraforming/template/tf/route_table_association.erb +9 -0
- data/lib/terraforming/template/tf/s3.erb +12 -0
- data/lib/terraforming/template/tf/security_group.erb +56 -0
- data/lib/terraforming/template/tf/sns_topic.erb +17 -0
- data/lib/terraforming/template/tf/sns_topic_subscription.erb +23 -0
- data/lib/terraforming/template/tf/sqs.erb +21 -0
- data/lib/terraforming/template/tf/subnet.erb +15 -0
- data/lib/terraforming/template/tf/vpc.erb +15 -0
- data/lib/terraforming/template/tf/vpn_gateway.erb +14 -0
- data/lib/terraforming/util.rb +30 -0
- data/lib/terraforming/version.rb +3 -0
- data/script/console +14 -0
- data/script/generate +97 -0
- data/script/setup +7 -0
- data/templates/resource.erb.erb +3 -0
- data/templates/resource.rb.erb +31 -0
- data/templates/resource_spec.rb.erb +39 -0
- data/terraforming.gemspec +31 -0
- metadata +271 -0
@@ -0,0 +1,63 @@
|
|
1
|
+
module Terraforming
|
2
|
+
module Resource
|
3
|
+
class IAMPolicy
|
4
|
+
include Terraforming::Util
|
5
|
+
|
6
|
+
def self.tf(client: Aws::IAM::Client.new)
|
7
|
+
self.new(client).tf
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.tfstate(client: Aws::IAM::Client.new)
|
11
|
+
self.new(client).tfstate
|
12
|
+
end
|
13
|
+
|
14
|
+
def initialize(client)
|
15
|
+
@client = client
|
16
|
+
end
|
17
|
+
|
18
|
+
def tf
|
19
|
+
apply_template(@client, "tf/iam_policy")
|
20
|
+
end
|
21
|
+
|
22
|
+
def tfstate
|
23
|
+
iam_policies.inject({}) do |resources, policy|
|
24
|
+
version = iam_policy_version_of(policy)
|
25
|
+
attributes = {
|
26
|
+
"id" => policy.arn,
|
27
|
+
"name" => policy.policy_name,
|
28
|
+
"path" => policy.path,
|
29
|
+
"description" => iam_policy_description(policy),
|
30
|
+
"policy" => prettify_policy(version.document, breakline: true, unescape: true),
|
31
|
+
}
|
32
|
+
resources["aws_iam_policy.#{module_name_of(policy)}"] = {
|
33
|
+
"type" => "aws_iam_policy",
|
34
|
+
"primary" => {
|
35
|
+
"id" => policy.arn,
|
36
|
+
"attributes" => attributes
|
37
|
+
}
|
38
|
+
}
|
39
|
+
|
40
|
+
resources
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
private
|
45
|
+
|
46
|
+
def iam_policies
|
47
|
+
@client.list_policies(scope: "Local").map(&:policies).flatten
|
48
|
+
end
|
49
|
+
|
50
|
+
def iam_policy_description(policy)
|
51
|
+
@client.get_policy(policy_arn: policy.arn).policy.description
|
52
|
+
end
|
53
|
+
|
54
|
+
def iam_policy_version_of(policy)
|
55
|
+
@client.get_policy_version(policy_arn: policy.arn, version_id: policy.default_version_id).policy_version
|
56
|
+
end
|
57
|
+
|
58
|
+
def module_name_of(policy)
|
59
|
+
normalize_module_name(policy.policy_name)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,86 @@
|
|
1
|
+
module Terraforming
|
2
|
+
module Resource
|
3
|
+
class IAMPolicyAttachment
|
4
|
+
include Terraforming::Util
|
5
|
+
|
6
|
+
def self.tf(client: Aws::IAM::Client.new)
|
7
|
+
self.new(client).tf
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.tfstate(client: Aws::IAM::Client.new)
|
11
|
+
self.new(client).tfstate
|
12
|
+
end
|
13
|
+
|
14
|
+
def initialize(client)
|
15
|
+
@client = client
|
16
|
+
end
|
17
|
+
|
18
|
+
def tf
|
19
|
+
apply_template(@client, "tf/iam_policy_attachment")
|
20
|
+
end
|
21
|
+
|
22
|
+
def tfstate
|
23
|
+
iam_policy_attachments.inject({}) do |resources, policy_attachment|
|
24
|
+
attributes = {
|
25
|
+
"id" => policy_attachment[:name],
|
26
|
+
"name" => policy_attachment[:name],
|
27
|
+
"policy_arn" => policy_attachment[:arn],
|
28
|
+
"groups.#" => policy_attachment[:entities].policy_groups.length.to_s,
|
29
|
+
"users.#" => policy_attachment[:entities].policy_users.length.to_s,
|
30
|
+
"roles.#" => policy_attachment[:entities].policy_roles.length.to_s,
|
31
|
+
}
|
32
|
+
resources["aws_iam_policy_attachment.#{module_name_of(policy_attachment)}"] = {
|
33
|
+
"type" => "aws_iam_policy_attachment",
|
34
|
+
"primary" => {
|
35
|
+
"id" => policy_attachment[:name],
|
36
|
+
"attributes" => attributes
|
37
|
+
}
|
38
|
+
}
|
39
|
+
|
40
|
+
resources
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
private
|
45
|
+
|
46
|
+
def attachment_name_from(policy)
|
47
|
+
"#{policy.policy_name}-policy-attachment"
|
48
|
+
end
|
49
|
+
|
50
|
+
def entities_for_policy(policy)
|
51
|
+
# list_entities_for_policy is a weird one: the response class
|
52
|
+
# has three different member variables that we need to
|
53
|
+
# paginate through altogether.
|
54
|
+
result = Aws::IAM::Types::ListEntitiesForPolicyResponse.new
|
55
|
+
result.policy_groups = []
|
56
|
+
result.policy_users = []
|
57
|
+
result.policy_roles = []
|
58
|
+
@client.list_entities_for_policy(policy_arn: policy.arn).each do |resp|
|
59
|
+
result.policy_groups += resp.policy_groups
|
60
|
+
result.policy_users += resp.policy_users
|
61
|
+
result.policy_roles += resp.policy_roles
|
62
|
+
end
|
63
|
+
|
64
|
+
result
|
65
|
+
end
|
66
|
+
|
67
|
+
def iam_policies
|
68
|
+
@client.list_policies(scope: "All", only_attached: true).map(&:policies).flatten
|
69
|
+
end
|
70
|
+
|
71
|
+
def iam_policy_attachments
|
72
|
+
iam_policies.map do |policy|
|
73
|
+
{
|
74
|
+
arn: policy.arn,
|
75
|
+
entities: entities_for_policy(policy),
|
76
|
+
name: attachment_name_from(policy),
|
77
|
+
}
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
def module_name_of(policy_attachment)
|
82
|
+
normalize_module_name(policy_attachment[:name])
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
module Terraforming
|
2
|
+
module Resource
|
3
|
+
class IAMRole
|
4
|
+
include Terraforming::Util
|
5
|
+
|
6
|
+
def self.tf(client: Aws::IAM::Client.new)
|
7
|
+
self.new(client).tf
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.tfstate(client: Aws::IAM::Client.new)
|
11
|
+
self.new(client).tfstate
|
12
|
+
end
|
13
|
+
|
14
|
+
def initialize(client)
|
15
|
+
@client = client
|
16
|
+
end
|
17
|
+
|
18
|
+
def tf
|
19
|
+
apply_template(@client, "tf/iam_role")
|
20
|
+
end
|
21
|
+
|
22
|
+
def tfstate
|
23
|
+
iam_roles.inject({}) do |resources, role|
|
24
|
+
attributes = {
|
25
|
+
"arn" => role.arn,
|
26
|
+
"assume_role_policy" =>
|
27
|
+
prettify_policy(role.assume_role_policy_document, breakline: true, unescape: true),
|
28
|
+
"id" => role.role_name,
|
29
|
+
"name" => role.role_name,
|
30
|
+
"path" => role.path,
|
31
|
+
"unique_id" => role.role_id,
|
32
|
+
}
|
33
|
+
resources["aws_iam_role.#{module_name_of(role)}"] = {
|
34
|
+
"type" => "aws_iam_role",
|
35
|
+
"primary" => {
|
36
|
+
"id" => role.role_name,
|
37
|
+
"attributes" => attributes
|
38
|
+
}
|
39
|
+
}
|
40
|
+
|
41
|
+
resources
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
private
|
46
|
+
|
47
|
+
def iam_roles
|
48
|
+
@client.list_roles.map(&:roles).flatten
|
49
|
+
end
|
50
|
+
|
51
|
+
def module_name_of(role)
|
52
|
+
normalize_module_name(role.role_name)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
module Terraforming
|
2
|
+
module Resource
|
3
|
+
class IAMRolePolicy
|
4
|
+
include Terraforming::Util
|
5
|
+
|
6
|
+
def self.tf(client: Aws::IAM::Client.new)
|
7
|
+
self.new(client).tf
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.tfstate(client: Aws::IAM::Client.new)
|
11
|
+
self.new(client).tfstate
|
12
|
+
end
|
13
|
+
|
14
|
+
def initialize(client)
|
15
|
+
@client = client
|
16
|
+
end
|
17
|
+
|
18
|
+
def tf
|
19
|
+
apply_template(@client, "tf/iam_role_policy")
|
20
|
+
end
|
21
|
+
|
22
|
+
def tfstate
|
23
|
+
iam_role_policies.inject({}) do |resources, policy|
|
24
|
+
attributes = {
|
25
|
+
"id" => iam_role_policy_id_of(policy),
|
26
|
+
"name" => policy.policy_name,
|
27
|
+
"policy" => prettify_policy(policy.policy_document, breakline: true, unescape: true),
|
28
|
+
"role" => policy.role_name,
|
29
|
+
}
|
30
|
+
resources["aws_iam_role_policy.#{unique_name(policy)}"] = {
|
31
|
+
"type" => "aws_iam_role_policy",
|
32
|
+
"primary" => {
|
33
|
+
"id" => iam_role_policy_id_of(policy),
|
34
|
+
"attributes" => attributes
|
35
|
+
}
|
36
|
+
}
|
37
|
+
|
38
|
+
resources
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
private
|
43
|
+
|
44
|
+
def unique_name(policy)
|
45
|
+
"#{normalize_module_name(policy.role_name)}_#{normalize_module_name(policy.policy_name)}"
|
46
|
+
end
|
47
|
+
|
48
|
+
def iam_role_policy_id_of(policy)
|
49
|
+
"#{policy.role_name}:#{policy.policy_name}"
|
50
|
+
end
|
51
|
+
|
52
|
+
def iam_roles
|
53
|
+
@client.list_roles.map(&:roles).flatten
|
54
|
+
end
|
55
|
+
|
56
|
+
def iam_role_policy_names_in(role)
|
57
|
+
@client.list_role_policies(role_name: role.role_name).policy_names
|
58
|
+
end
|
59
|
+
|
60
|
+
def iam_role_policy_of(role, policy_name)
|
61
|
+
@client.get_role_policy(role_name: role.role_name, policy_name: policy_name)
|
62
|
+
end
|
63
|
+
|
64
|
+
def iam_role_policies
|
65
|
+
iam_roles.map do |role|
|
66
|
+
iam_role_policy_names_in(role).map { |policy_name| iam_role_policy_of(role, policy_name) }
|
67
|
+
end.flatten
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
module Terraforming
|
2
|
+
module Resource
|
3
|
+
class IAMUser
|
4
|
+
include Terraforming::Util
|
5
|
+
|
6
|
+
def self.tf(client: Aws::IAM::Client.new)
|
7
|
+
self.new(client).tf
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.tfstate(client: Aws::IAM::Client.new)
|
11
|
+
self.new(client).tfstate
|
12
|
+
end
|
13
|
+
|
14
|
+
def initialize(client)
|
15
|
+
@client = client
|
16
|
+
end
|
17
|
+
|
18
|
+
def tf
|
19
|
+
apply_template(@client, "tf/iam_user")
|
20
|
+
end
|
21
|
+
|
22
|
+
def tfstate
|
23
|
+
iam_users.inject({}) do |resources, user|
|
24
|
+
attributes = {
|
25
|
+
"arn" => user.arn,
|
26
|
+
"id" => user.user_name,
|
27
|
+
"name" => user.user_name,
|
28
|
+
"path" => user.path,
|
29
|
+
"unique_id" => user.user_id,
|
30
|
+
"force_destroy" => "false",
|
31
|
+
}
|
32
|
+
resources["aws_iam_user.#{module_name_of(user)}"] = {
|
33
|
+
"type" => "aws_iam_user",
|
34
|
+
"primary" => {
|
35
|
+
"id" => user.user_name,
|
36
|
+
"attributes" => attributes,
|
37
|
+
}
|
38
|
+
}
|
39
|
+
|
40
|
+
resources
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
private
|
45
|
+
|
46
|
+
def iam_users
|
47
|
+
@client.list_users.map(&:users).flatten
|
48
|
+
end
|
49
|
+
|
50
|
+
def module_name_of(user)
|
51
|
+
normalize_module_name(user.user_name)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
module Terraforming
|
2
|
+
module Resource
|
3
|
+
class IAMUserPolicy
|
4
|
+
include Terraforming::Util
|
5
|
+
|
6
|
+
def self.tf(client: Aws::IAM::Client.new)
|
7
|
+
self.new(client).tf
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.tfstate(client: Aws::IAM::Client.new)
|
11
|
+
self.new(client).tfstate
|
12
|
+
end
|
13
|
+
|
14
|
+
def initialize(client)
|
15
|
+
@client = client
|
16
|
+
end
|
17
|
+
|
18
|
+
def tf
|
19
|
+
apply_template(@client, "tf/iam_user_policy")
|
20
|
+
end
|
21
|
+
|
22
|
+
def tfstate
|
23
|
+
iam_user_policies.inject({}) do |resources, policy|
|
24
|
+
attributes = {
|
25
|
+
"id" => iam_user_policy_id_of(policy),
|
26
|
+
"name" => policy.policy_name,
|
27
|
+
"policy" => prettify_policy(policy.policy_document, breakline: true, unescape: true),
|
28
|
+
"user" => policy.user_name,
|
29
|
+
}
|
30
|
+
resources["aws_iam_user_policy.#{unique_name(policy)}"] = {
|
31
|
+
"type" => "aws_iam_user_policy",
|
32
|
+
"primary" => {
|
33
|
+
"id" => iam_user_policy_id_of(policy),
|
34
|
+
"attributes" => attributes
|
35
|
+
}
|
36
|
+
}
|
37
|
+
|
38
|
+
resources
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
private
|
43
|
+
|
44
|
+
def unique_name(policy)
|
45
|
+
"#{normalize_module_name(policy.user_name)}_#{normalize_module_name(policy.policy_name)}"
|
46
|
+
end
|
47
|
+
|
48
|
+
def iam_user_policy_id_of(policy)
|
49
|
+
"#{policy.user_name}:#{policy.policy_name}"
|
50
|
+
end
|
51
|
+
|
52
|
+
def iam_users
|
53
|
+
@client.list_users.map(&:users).flatten
|
54
|
+
end
|
55
|
+
|
56
|
+
def iam_user_policy_names_in(user)
|
57
|
+
@client.list_user_policies(user_name: user.user_name).policy_names
|
58
|
+
end
|
59
|
+
|
60
|
+
def iam_user_policy_of(user, policy_name)
|
61
|
+
@client.get_user_policy(user_name: user.user_name, policy_name: policy_name)
|
62
|
+
end
|
63
|
+
|
64
|
+
def iam_user_policies
|
65
|
+
iam_users.map do |user|
|
66
|
+
iam_user_policy_names_in(user).map { |policy_name| iam_user_policy_of(user, policy_name) }
|
67
|
+
end.flatten
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
module Terraforming
|
2
|
+
module Resource
|
3
|
+
class InternetGateway
|
4
|
+
include Terraforming::Util
|
5
|
+
|
6
|
+
def self.tf(client: Aws::EC2::Client.new)
|
7
|
+
self.new(client).tf
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.tfstate(client: Aws::EC2::Client.new)
|
11
|
+
self.new(client).tfstate
|
12
|
+
end
|
13
|
+
|
14
|
+
def initialize(client)
|
15
|
+
@client = client
|
16
|
+
end
|
17
|
+
|
18
|
+
def tf
|
19
|
+
apply_template(@client, "tf/internet_gateway")
|
20
|
+
end
|
21
|
+
|
22
|
+
def tfstate
|
23
|
+
internet_gateways.inject({}) do |resources, internet_gateway|
|
24
|
+
next resources if internet_gateway.attachments.empty?
|
25
|
+
|
26
|
+
attributes = {
|
27
|
+
"id" => internet_gateway.internet_gateway_id,
|
28
|
+
"vpc_id" => internet_gateway.attachments[0].vpc_id,
|
29
|
+
"tags.#" => internet_gateway.tags.length.to_s,
|
30
|
+
}
|
31
|
+
resources["aws_internet_gateway.#{module_name_of(internet_gateway)}"] = {
|
32
|
+
"type" => "aws_internet_gateway",
|
33
|
+
"primary" => {
|
34
|
+
"id" => internet_gateway.internet_gateway_id,
|
35
|
+
"attributes" => attributes
|
36
|
+
}
|
37
|
+
}
|
38
|
+
|
39
|
+
resources
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
private
|
44
|
+
|
45
|
+
def internet_gateways
|
46
|
+
@client.describe_internet_gateways.map(&:internet_gateways).flatten
|
47
|
+
end
|
48
|
+
|
49
|
+
def module_name_of(internet_gateway)
|
50
|
+
normalize_module_name(name_from_tag(internet_gateway, internet_gateway.internet_gateway_id))
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|