convection 2.2.13 → 2.2.14

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
2
  SHA1:
3
- metadata.gz: cc4c4bbe225ec33757f900d24c62f5629644e4ae
4
- data.tar.gz: b3e00e9748782113a6a7491cacb12cdc0b2f71e0
3
+ metadata.gz: db4f0ff7ceba52ed22c04a56074eb50a8e47bbb7
4
+ data.tar.gz: 451da49003a3086b1d66817c2cefd3533d3e47d1
5
5
  SHA512:
6
- metadata.gz: 731c78af0486d452e249a27c40499bbe4d44d44df7a5fd35c7501c6104ddb4720ccdf60b870574f2b3808510a85870530351e241a20aa6167fe712116a21d09f
7
- data.tar.gz: 88af87c51fa62ca1be9e73748d90abfe9a0bbb63b0946d028fe3a5a2ae01eb218b6285ae4145faf4fb40acac07cf2cfb864697dad6678a7e156679a6529bc653
6
+ metadata.gz: 3f72ea77bd23236a874b0072481505fc330bf060dff21d6f3cdd2cda4ddf3f285ec05953caeb2634277e3b7302b4669b1dd88718d58d335b187e88dae0b17691
7
+ data.tar.gz: 246c0a685b68d385eb9d3cacbf48ba441734f8b352158e30cd162782039b3174aed21e65c72a303195e986171c2f9646f21d7f6ffa4b45211f2355f044bec6fe
@@ -24,6 +24,44 @@ module Convection
24
24
  property :statistic, 'Statistic'
25
25
  property :threshold, 'Threshold'
26
26
  property :unit, 'Unit'
27
+
28
+ def terraform_import_commands(module_path: 'root')
29
+ prefix = "#{module_path}." unless module_path == 'root'
30
+ commands = ['# Run the following commands to import your infrastructure into terraform management.', '# ensure :module_path is set correctly', '']
31
+ commands << "terraform import #{prefix}aws_cloudwatch_metric_alarm.#{name.underscore} #{stack.resources[name].physical_resource_id}"
32
+ commands << ''
33
+ commands
34
+ end
35
+
36
+ def to_hcl_json(*)
37
+ tf_alarm_attrs = {
38
+ alarm_name: alarm_name,
39
+ comparison_operator: comparison_operator,
40
+ evaluation_periods: evaluation_periods,
41
+ metric_name: metric_name,
42
+ namespace: namespace,
43
+ period: period,
44
+ statistic: statistic,
45
+ threshold: threshold,
46
+ actions_enabled: actions_enabled,
47
+ alarm_actions: alarm_action,
48
+ alarm_description: alarm_description,
49
+ dimensions: dimension,
50
+ insufficient_data_actions: insufficient_data_action,
51
+ ok_actions: ok_action,
52
+ unit: unit
53
+ }
54
+
55
+ tf_alarm_attrs.reject! { |_, v| v.nil? }
56
+
57
+ tf_alarm = {
58
+ aws_cloudwatch_metric_alarm: {
59
+ name.underscore => tf_alarm_attrs
60
+ }
61
+ }
62
+
63
+ { resource: [tf_alarm] }.to_json
64
+ end
27
65
  end
28
66
  end
29
67
  end
@@ -94,7 +94,6 @@ module Convection
94
94
  {
95
95
  aws_iam_user: {
96
96
  name.underscore => {
97
- managed_policy_arns: '${var.managed_policy_arns}',
98
97
  name: '${var.name}',
99
98
  path: '${var.path}'
100
99
  }
@@ -114,6 +113,15 @@ module Convection
114
113
  }
115
114
  }
116
115
  end
116
+ policy_resources << {
117
+ aws_iam_user_policy_attachment: {
118
+ "#{name.underscore}_managed" => {
119
+ count: managed_policy_arn.count,
120
+ user: "${aws_iam_user.#{name.underscore}.id}",
121
+ policy_arn: '${element(var.managed_policy_arns, count.index)}'
122
+ }
123
+ }
124
+ }
117
125
  result["#{module_prefix}#{name.underscore}-policy.tf.json"] = { resource: policy_resources }
118
126
 
119
127
  result
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: convection
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.13
4
+ version: 2.2.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Manero
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-01-19 00:00:00.000000000 Z
11
+ date: 2018-02-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport