dd2tf 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +13 -0
- data/.rspec +2 -0
- data/.travis.yml +5 -0
- data/Gemfile +6 -0
- data/LICENSE.txt +21 -0
- data/README.md +100 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/dd2tf.gemspec +31 -0
- data/exe/dd2tf +39 -0
- data/lib/dd2tf.rb +6 -0
- data/lib/dd2tf/base.rb +28 -0
- data/lib/dd2tf/config.rb +9 -0
- data/lib/dd2tf/monitor.rb +17 -0
- data/lib/dd2tf/timeboard.rb +16 -0
- data/lib/dd2tf/user.rb +17 -0
- data/lib/dd2tf/version.rb +3 -0
- data/lib/templates/monitor.erb.rb +52 -0
- data/lib/templates/timeboard.erb.rb +115 -0
- data/lib/templates/user.erb.rb +16 -0
- metadata +150 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 82d0db5b5903fbc996346236e51bf6412d723a15
|
4
|
+
data.tar.gz: 83bddb1d834f87b17d37bc61c406252314815f39
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e0ff4170bc88feb5b4ac6615537c32b54a0c8dfb1d67f6a267ca7363abd3df03ac67a96d5565f219384636c0e709960befe5872948b7e70efd88eb94cca24386
|
7
|
+
data.tar.gz: 17a102ecffb7b75d0679cb40951bbe5c6fb3ab66d684f1386dba54f362ec91996a0ff20ffdba9e79fc1f401607263e1e41876b63dd627bab4e8184f493f2fe60
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 reizist
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,100 @@
|
|
1
|
+
# Dd2tf
|
2
|
+
|
3
|
+
This gem export datadog configuration as terraform format.
|
4
|
+
Inspired by [kurochan/datadog_monitor2terraform](https://github.com/kurochan/datadog_monitor2terraform)
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
Add this line to your application's Gemfile:
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
gem 'dd2tf'
|
12
|
+
```
|
13
|
+
|
14
|
+
And then execute:
|
15
|
+
|
16
|
+
$ bundle
|
17
|
+
|
18
|
+
Or install it yourself as:
|
19
|
+
|
20
|
+
$ gem install dd2tf
|
21
|
+
|
22
|
+
## Usage
|
23
|
+
|
24
|
+
```
|
25
|
+
$ dd2tf help
|
26
|
+
Commands:
|
27
|
+
dd2tf help [COMMAND] # Describe available commands or one specific command
|
28
|
+
dd2tf puts monitor configuration as terraform config # puts monitor config
|
29
|
+
dd2tf puts timeboard configuration as terraform config # puts timeboard config
|
30
|
+
dd2tf puts user configuration as terraform config # puts user config
|
31
|
+
|
32
|
+
Options:
|
33
|
+
[--dd-api-key=DD_API_KEY]
|
34
|
+
[--dd-app-key=DD_APP_KEY]
|
35
|
+
```
|
36
|
+
|
37
|
+
e.g.
|
38
|
+
|
39
|
+
```
|
40
|
+
$ dd2tf user --dd_api_key=xxx --dd-app_key=xxx
|
41
|
+
resource "datadog_user" "reiji_kainuma" {
|
42
|
+
disabled = "false"
|
43
|
+
email = "reizist@gmail.com"
|
44
|
+
handle = "reizist@gmail.com"
|
45
|
+
is_admin = "true"
|
46
|
+
name = "Reiji Kainuma"
|
47
|
+
role = ""
|
48
|
+
}
|
49
|
+
|
50
|
+
```
|
51
|
+
|
52
|
+
```
|
53
|
+
$ dd2tf monitor --dd_api_key=xxx --dd-app_key=xxx
|
54
|
+
resource "datadog_monitor" "auto_clock_in_sync_with_ntp" {
|
55
|
+
name = "[Auto] Clock in sync with NTP"
|
56
|
+
type = "service check"
|
57
|
+
message = <<EOF
|
58
|
+
Triggers if any host's clock goes out of sync with the time given by NTP. The offset threshold is configured in the Agent's `ntp.yaml` file.
|
59
|
+
|
60
|
+
Please read the [KB article](http://help.datadoghq.com/hc/en-us/articles/204282095-Network-Time-Protocol-NTP-Offset-Issues) on NTP Offset issues for more details on cause and resolution.
|
61
|
+
EOF
|
62
|
+
query = "\"ntp.in_sync\".over(\"*\").last(2).count_by_status()"
|
63
|
+
thresholds {
|
64
|
+
ok = 1
|
65
|
+
warning = 1
|
66
|
+
critical = 1
|
67
|
+
}
|
68
|
+
tags = []
|
69
|
+
}
|
70
|
+
```
|
71
|
+
|
72
|
+
```
|
73
|
+
$ dd2tf timeboard --dd_api_key=xxx --dd-app_key=xxx
|
74
|
+
resource "datadog_timeboard" "presto_staging" {
|
75
|
+
title = "Presto(staging)"
|
76
|
+
description = "created by xxx"
|
77
|
+
read_only = false
|
78
|
+
|
79
|
+
|
80
|
+
graph {
|
81
|
+
title = "cluster_memory_manager_metrics"
|
82
|
+
viz = "timeseries"
|
83
|
+
autoscale = "true"
|
84
|
+
|
85
|
+
request {
|
86
|
+
q = "avg:presto_staging.cluster_memory_manager_metrics.cluster_memory_usage_bytes{*}"
|
87
|
+
aggregator = "avg"
|
88
|
+
type = "line"
|
89
|
+
}
|
90
|
+
request {
|
91
|
+
q = "avg:presto_staging.cluster_memory_manager_metrics.cluster_memory_bytes{*}"
|
92
|
+
type = "line"
|
93
|
+
}
|
94
|
+
}
|
95
|
+
}
|
96
|
+
```
|
97
|
+
|
98
|
+
# Contributing
|
99
|
+
|
100
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/reizist/dd2tf. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "dd2tf"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
require "pry"
|
11
|
+
Pry.start
|
12
|
+
|
13
|
+
# require "irb"
|
14
|
+
# IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/dd2tf.gemspec
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "dd2tf/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "dd2tf"
|
8
|
+
spec.version = Dd2tf::VERSION
|
9
|
+
spec.authors = ["reizist"]
|
10
|
+
spec.email = ["reizist@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Export Datadog resource as terraform config}
|
13
|
+
spec.description = spec.summary
|
14
|
+
spec.homepage = "https://github.com/reizist/dd2tf"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
18
|
+
f.match(%r{^(test|spec|features)/})
|
19
|
+
end
|
20
|
+
spec.bindir = "exe"
|
21
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
|
+
spec.require_paths = ["lib"]
|
23
|
+
|
24
|
+
spec.add_runtime_dependency "dogapi"
|
25
|
+
spec.add_runtime_dependency "activesupport"
|
26
|
+
spec.add_runtime_dependency "thor"
|
27
|
+
|
28
|
+
spec.add_development_dependency "bundler", "~> 1.15"
|
29
|
+
spec.add_development_dependency "rake", "~> 12.0.0"
|
30
|
+
spec.add_development_dependency "pry"
|
31
|
+
end
|
data/exe/dd2tf
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'dd2tf'
|
4
|
+
require 'thor'
|
5
|
+
require 'dogapi'
|
6
|
+
|
7
|
+
module Dd2tf
|
8
|
+
class Cli < Thor
|
9
|
+
include Thor::Actions
|
10
|
+
|
11
|
+
class_option :dd_api_key, type: :string
|
12
|
+
class_option :dd_app_key, type: :string
|
13
|
+
|
14
|
+
desc "puts monitor configuration as terraform config", "puts monitor config"
|
15
|
+
def monitor
|
16
|
+
puts Monitor.new(client).output
|
17
|
+
end
|
18
|
+
|
19
|
+
desc "puts timeboard configuration as terraform config", "puts timeboard config"
|
20
|
+
def timeboard
|
21
|
+
puts Timeboard.new(client).output
|
22
|
+
end
|
23
|
+
|
24
|
+
desc "puts user configuration as terraform config", "puts user config"
|
25
|
+
def user
|
26
|
+
puts User.new(client).output
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def client
|
32
|
+
return @client unless @client.nil?
|
33
|
+
config = Config.new(options[:dd_api_key], options[:dd_app_key])
|
34
|
+
@client ||= ::Dogapi::Client.new(config.api_key, config.app_key)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
Dd2tf::Cli.start
|
data/lib/dd2tf.rb
ADDED
data/lib/dd2tf/base.rb
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'erb'
|
2
|
+
require 'active_support'
|
3
|
+
require 'active_support/core_ext'
|
4
|
+
|
5
|
+
module Dd2tf
|
6
|
+
class Base
|
7
|
+
class NotImplementedError < StandardError; end
|
8
|
+
UNALLOWED_RESOURCE_TITLE_REGEXP = /\(|\)|'|\.|\[|\]|:/
|
9
|
+
|
10
|
+
def initialize(client)
|
11
|
+
@client = client
|
12
|
+
end
|
13
|
+
|
14
|
+
def output
|
15
|
+
raise NotImplementedError
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def template_file
|
21
|
+
File.read("./lib/templates/#{self.class.name.split(":").last.underscore}.erb.rb")
|
22
|
+
end
|
23
|
+
|
24
|
+
def renderer
|
25
|
+
ERB.new(template_file, nil, "-")
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
data/lib/dd2tf/config.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
module Dd2tf
|
2
|
+
class Monitor < Base
|
3
|
+
|
4
|
+
def output
|
5
|
+
monitors = @client.get_all_monitors[1]
|
6
|
+
|
7
|
+
results = []
|
8
|
+
monitors.each do |monitor|
|
9
|
+
monitor_name = monitor["name"].underscore.gsub(" ", "_").gsub(UNALLOWED_RESOURCE_TITLE_REGEXP, '')
|
10
|
+
renderer = renderer()
|
11
|
+
results << renderer.result(binding)
|
12
|
+
end
|
13
|
+
|
14
|
+
results
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Dd2tf
|
2
|
+
class Timeboard < Base
|
3
|
+
def output
|
4
|
+
results = []
|
5
|
+
board_ids = @client.get_dashboards[1]["dashes"].map{|board| board["id"]}
|
6
|
+
board_ids.each do |board_id|
|
7
|
+
board = @client.get_dashboard(board_id)[1]["dash"]
|
8
|
+
board_name = board["title"].underscore.gsub(' ', '_').gsub(UNALLOWED_RESOURCE_TITLE_REGEXP, '')
|
9
|
+
renderer = renderer()
|
10
|
+
results << renderer.result(binding)
|
11
|
+
end
|
12
|
+
|
13
|
+
results
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/lib/dd2tf/user.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
module Dd2tf
|
2
|
+
class User < Base
|
3
|
+
|
4
|
+
def output
|
5
|
+
users = @client.get_all_users[1]["users"]
|
6
|
+
|
7
|
+
results = []
|
8
|
+
users.each do |user|
|
9
|
+
user_name = user["name"].to_s.underscore.gsub(" ", "_").gsub(UNALLOWED_RESOURCE_TITLE_REGEXP, '')
|
10
|
+
renderer = renderer()
|
11
|
+
results << renderer.result(binding)
|
12
|
+
end
|
13
|
+
|
14
|
+
results
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
resource "datadog_monitor" "<%= monitor_name %>" {
|
2
|
+
name = "<%= monitor["name"] %>"
|
3
|
+
type = "<%= monitor["type"] %>"
|
4
|
+
message = <<EOF
|
5
|
+
<%= monitor["message"] %>
|
6
|
+
EOF
|
7
|
+
query = "<%= monitor["query"].gsub('"', '\\"') %>"
|
8
|
+
<%- if monitor["options"]["escalation_message"] != nil -%>
|
9
|
+
escalation_message = "<%= monitor["options"]["escalation_message"] %>"
|
10
|
+
<%- end -%>
|
11
|
+
<%- if monitor["options"]["thresholds"] != nil && monitor["options"]["thresholds"] != {} -%>
|
12
|
+
thresholds {
|
13
|
+
<%- if monitor["options"]["thresholds"]["ok"] != nil -%>
|
14
|
+
ok = <%= monitor["options"]["thresholds"]["ok"] %>
|
15
|
+
<%- end -%>
|
16
|
+
<%- if monitor["options"]["thresholds"]["warning"] != nil -%>
|
17
|
+
warning = <%= monitor["options"]["thresholds"]["warning"] %>
|
18
|
+
<%- end -%>
|
19
|
+
<%- if monitor["options"]["thresholds"]["critical"] != nil -%>
|
20
|
+
critical = <%= monitor["options"]["thresholds"]["critical"] %>
|
21
|
+
<%- end -%>
|
22
|
+
}
|
23
|
+
<%- end -%>
|
24
|
+
<%- if monitor["options"]["notify_no_data"] != nil -%>
|
25
|
+
notify_no_data = <%= monitor["options"]["notify_no_data"] %>
|
26
|
+
<%- end -%>
|
27
|
+
<%- if monitor["options"]["no_data_timeframe"] != nil -%>
|
28
|
+
no_data_timeframe = <%= monitor["options"]["no_data_timeframe"] %>
|
29
|
+
<%- end -%>
|
30
|
+
<%- if monitor["options"]["new_host_delay"] != nil -%>
|
31
|
+
new_host_delay = <%= monitor["options"]["new_host_delay"] %>
|
32
|
+
<%- end -%>
|
33
|
+
<%- if monitor["options"]["evaluation_delay"] != nil -%>
|
34
|
+
evaluation_delay = <%= monitor["options"]["evaluation_delay"] %>
|
35
|
+
<%- end -%>
|
36
|
+
<%- if monitor["options"]["renotify_interval"] != nil -%>
|
37
|
+
renotify_interval = <%= monitor["options"]["renotify_interval"] %>
|
38
|
+
<%- end -%>
|
39
|
+
<%- if monitor["options"]["timeout_h"] != nil -%>
|
40
|
+
timeout_h = <%= monitor["options"]["timeout_h"] %>
|
41
|
+
<%- end -%>
|
42
|
+
<%- if monitor["options"]["include_tags"] != nil -%>
|
43
|
+
include_tags = <%= monitor["options"]["include_tags"] %>
|
44
|
+
<%- end -%>
|
45
|
+
<%- if monitor["options"]["require_full_window"] != nil -%>
|
46
|
+
require_full_window = <%= monitor["options"]["require_full_window"] %>
|
47
|
+
<%- end -%>
|
48
|
+
<%- if monitor["options"]["notify_audit"] != nil -%>
|
49
|
+
notify_audit = <%= monitor["options"]["notify_audit"] %>
|
50
|
+
<%- end -%>
|
51
|
+
tags = <%= monitor["tags"] %>
|
52
|
+
}
|
@@ -0,0 +1,115 @@
|
|
1
|
+
resource "datadog_timeboard" "<%= board_name %>" {
|
2
|
+
title = "<%= board["title"] %>"
|
3
|
+
description = "<%= board["description"] %>"
|
4
|
+
read_only = <%= board["read_only"] %>
|
5
|
+
|
6
|
+
<%- if !board["template_variables"].nil? && board["template_variables"].count > 0 -%>
|
7
|
+
<%- board["template_variables"].each do |template_variable| -%>
|
8
|
+
template_variable {
|
9
|
+
name = "<%= template_variable["name"] %>"
|
10
|
+
prefix = "<%= template_variable["prefix"] %>"
|
11
|
+
default = "<%= template_variable["default"] %>"
|
12
|
+
}
|
13
|
+
<%- end -%>
|
14
|
+
<%- end -%>
|
15
|
+
|
16
|
+
<%- if board["graphs"].count > 0 -%>
|
17
|
+
<%- board["graphs"].each do |graph| -%>
|
18
|
+
graph {
|
19
|
+
title = "<%= graph["title"] %>"
|
20
|
+
viz = "<%= graph["definition"]["viz"] %>"
|
21
|
+
<%- if !graph["definition"]["autoscale"].nil? -%>
|
22
|
+
autoscale = "<%= graph["definition"]["autoscale"] %>"
|
23
|
+
<%- end -%>
|
24
|
+
|
25
|
+
<%- graph["definition"]["requests"].each do |request| -%>
|
26
|
+
request {
|
27
|
+
q = "<%= request["q"] %>"
|
28
|
+
<%- unless request["aggregator"].nil? -%>
|
29
|
+
aggregator = "<%= request["aggregator"] %>"
|
30
|
+
<%- end -%>
|
31
|
+
<%- unless request["stacked"].nil? -%>
|
32
|
+
stacked = "<%= request["stacked"] %>"
|
33
|
+
<%- end -%>
|
34
|
+
<%- unless request["type"].nil? -%>
|
35
|
+
type = "<%= request["type"] %>"
|
36
|
+
<%- end -%>
|
37
|
+
<%- unless request["style"].nil? -%>
|
38
|
+
style = {
|
39
|
+
<%- unless request["style"]["width"].nil? -%>
|
40
|
+
width = "<%= request["style"]["width"] %>"
|
41
|
+
<%- end -%>
|
42
|
+
<%- unless request["style"]["type"].nil? -%>
|
43
|
+
type = "<%= request["style"]["type"] %>"
|
44
|
+
<%- end -%>
|
45
|
+
<%- unless request["style"]["palette"].nil? -%>
|
46
|
+
palette = "<%= request["style"]["palette"] %>"
|
47
|
+
<%- end -%>
|
48
|
+
}
|
49
|
+
<%- end -%>
|
50
|
+
}
|
51
|
+
<%- end -%>
|
52
|
+
<%- if !graph["definition"]["events"].nil? -%>
|
53
|
+
events = <%= graph["definition"]["events"] %>
|
54
|
+
<%- end -%>
|
55
|
+
<%- if !graph["definition"]["precision"].nil? -%>
|
56
|
+
precision = "<%= graph["definition"]["precision"] %>"
|
57
|
+
<%- end -%>
|
58
|
+
<%- if !graph["definition"]["custom_unit"].nil? -%>
|
59
|
+
custom_unit = "<%= graph["definition"]["custom_unit"] %>"
|
60
|
+
<%- end -%>
|
61
|
+
<%- if !graph["definition"]["text_align"].nil? -%>
|
62
|
+
text_align = "<%= graph["definition"]["text_align"] %>"
|
63
|
+
<%- end -%>
|
64
|
+
<%- unless graph["definition"]["style"].nil? -%>
|
65
|
+
style = {
|
66
|
+
<%- unless graph["definition"]["style"]["palette"].nil? -%>
|
67
|
+
palette = "<%= graph["definition"]["style"]["palette"] %>"
|
68
|
+
<%- end -%>
|
69
|
+
<%- unless graph["definition"]["style"]["palette_flip"].nil? -%>
|
70
|
+
palette_flip = "<%= graph["definition"]["style"]["palette_flip"] %>"
|
71
|
+
<%- end -%>
|
72
|
+
}
|
73
|
+
<%- end -%>
|
74
|
+
<%- unless graph["definition"]["group"].nil? -%>
|
75
|
+
group = "<%= graph["definition"]["group"] %>"
|
76
|
+
<%- end -%>
|
77
|
+
<%- unless graph["definition"]["include_no_metric_hosts"].nil? -%>
|
78
|
+
include_no_metric_hosts = "<%= graph["definition"]["include_no_metric_hosts"] %>"
|
79
|
+
<%- end -%>
|
80
|
+
<%- unless graph["definition"]["include_ungrouped_hosts"].nil? -%>
|
81
|
+
include_ungrouped_hosts = "<%= graph["definition"]["include_ungrouped_hosts"] %>"
|
82
|
+
<%- end -%>
|
83
|
+
<%- unless graph["definition"]["scope"].nil? -%>
|
84
|
+
scope = "<%= graph["definition"]["scope"] %>"
|
85
|
+
<%- end -%>
|
86
|
+
<%- unless graph["definition"]["yaxis"].nil? -%>
|
87
|
+
yaxis = {
|
88
|
+
<%- unless graph["definition"]["yaxis"]["min"].nil? -%>
|
89
|
+
min = "<%= graph["definition"]["yaxis"]["min"] %>"
|
90
|
+
<%- end -%>
|
91
|
+
<%- unless graph["definition"]["yaxis"]["max"].nil? -%>
|
92
|
+
max = "<%= graph["definition"]["yaxis"]["max"] %>"
|
93
|
+
<%- end -%>
|
94
|
+
<%- unless graph["definition"]["yaxis"]["scale"].nil? -%>
|
95
|
+
scale = "<%= graph["definition"]["yaxis"]["scale"] %>"
|
96
|
+
<%- end -%>
|
97
|
+
}
|
98
|
+
<%- end -%>
|
99
|
+
<%- unless graph["definition"]["marker"].nil? -%>
|
100
|
+
marker = {
|
101
|
+
<%- unless graph["definition"]["marker"]["type"].nil? -%>
|
102
|
+
type = "<%= graph["definition"]["marker"]["type"] %>"
|
103
|
+
<%- end -%>
|
104
|
+
<%- unless graph["definition"]["marker"]["value"].nil? -%>
|
105
|
+
value = "<%= graph["definition"]["marker"]["value"] %>"
|
106
|
+
<%- end -%>
|
107
|
+
<%- unless graph["definition"]["marker"]["label"].nil? -%>
|
108
|
+
label = "<%= graph["definition"]["marker"]["label"] %>"
|
109
|
+
<%- end -%>
|
110
|
+
}
|
111
|
+
<%- end -%>
|
112
|
+
}
|
113
|
+
<%- end -%>
|
114
|
+
<%- end -%>
|
115
|
+
}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
resource "datadog_user" "<%= user_name %>" {
|
2
|
+
<%- unless user["disabled"].nil? -%>
|
3
|
+
disabled = "<%= user["disabled"] %>"
|
4
|
+
<%- end -%>
|
5
|
+
<%- unless user["email"].nil? -%>
|
6
|
+
email = "<%= user["email"] %>"
|
7
|
+
<%- end -%>
|
8
|
+
handle = "<%= user["handle"] %>"
|
9
|
+
<%- unless user["is_admin"].nil? -%>
|
10
|
+
is_admin = "<%= user["is_admin"] %>"
|
11
|
+
<%- end -%>
|
12
|
+
name = "<%= user["name"] %>"
|
13
|
+
<%- unless user["role"].nil? -%>
|
14
|
+
role = "<%= user["role"] %>"
|
15
|
+
<%- end -%>
|
16
|
+
}
|
metadata
ADDED
@@ -0,0 +1,150 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: dd2tf
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- reizist
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-10-02 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: dogapi
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: activesupport
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: thor
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: bundler
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.15'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.15'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rake
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 12.0.0
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 12.0.0
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: pry
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
description: Export Datadog resource as terraform config
|
98
|
+
email:
|
99
|
+
- reizist@gmail.com
|
100
|
+
executables:
|
101
|
+
- dd2tf
|
102
|
+
extensions: []
|
103
|
+
extra_rdoc_files: []
|
104
|
+
files:
|
105
|
+
- ".gitignore"
|
106
|
+
- ".rspec"
|
107
|
+
- ".travis.yml"
|
108
|
+
- Gemfile
|
109
|
+
- LICENSE.txt
|
110
|
+
- README.md
|
111
|
+
- Rakefile
|
112
|
+
- bin/console
|
113
|
+
- bin/setup
|
114
|
+
- dd2tf.gemspec
|
115
|
+
- exe/dd2tf
|
116
|
+
- lib/dd2tf.rb
|
117
|
+
- lib/dd2tf/base.rb
|
118
|
+
- lib/dd2tf/config.rb
|
119
|
+
- lib/dd2tf/monitor.rb
|
120
|
+
- lib/dd2tf/timeboard.rb
|
121
|
+
- lib/dd2tf/user.rb
|
122
|
+
- lib/dd2tf/version.rb
|
123
|
+
- lib/templates/monitor.erb.rb
|
124
|
+
- lib/templates/timeboard.erb.rb
|
125
|
+
- lib/templates/user.erb.rb
|
126
|
+
homepage: https://github.com/reizist/dd2tf
|
127
|
+
licenses:
|
128
|
+
- MIT
|
129
|
+
metadata: {}
|
130
|
+
post_install_message:
|
131
|
+
rdoc_options: []
|
132
|
+
require_paths:
|
133
|
+
- lib
|
134
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
140
|
+
requirements:
|
141
|
+
- - ">="
|
142
|
+
- !ruby/object:Gem::Version
|
143
|
+
version: '0'
|
144
|
+
requirements: []
|
145
|
+
rubyforge_project:
|
146
|
+
rubygems_version: 2.6.11
|
147
|
+
signing_key:
|
148
|
+
specification_version: 4
|
149
|
+
summary: Export Datadog resource as terraform config
|
150
|
+
test_files: []
|