tflat 0.1.2 → 0.1.3

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
  SHA256:
3
- metadata.gz: f7f0542a87cf91985a9d85fbb008a929c8476f8ee6c5bf140e35c30a049bf521
4
- data.tar.gz: 03b4b5f6f38256fc3d9db1ed1b0d23331f4195e1787e527d1702497f2b45f97c
3
+ metadata.gz: 4d15b9198d7b98f7db2eebf26bc45cde58a272fc185b994df397944ef4c5eca1
4
+ data.tar.gz: cff2e13e095dfdf4d48c644afa3a59ed2230fda74045a2b854c59d6861044c0c
5
5
  SHA512:
6
- metadata.gz: 3902861c7d4683a40a07ae308f65ed0b69856b649294e005e76a108b93189d6b4adf242c527cbde2e7236ae9a7454d4ce494788ef7b33ce276b4ff9b231503d8
7
- data.tar.gz: 9d89086124665920668439b094c81ebe7bd10cb9adabd3618370ab6bfabe0d65ceefbda82123bed30f04bae3e118ecb1d77ce70e5b0756951affc22b23c6e347
6
+ metadata.gz: 3484b425066f7d77e27f98a61d7d80d349133127dd578eb1254032da3e9eac8cb3b98b9e1bcc0a1cabe8648af049d75b22508bf9e9d5d3bbe74c99f106096d92
7
+ data.tar.gz: a8afe6be65b184561fa55512e26223d6081a433fc39df7394ba339a90c6fce92c7d4e6774f3f151daaa788787888b28d70c941b1d33df2d03c3032b3f5e46bf0
@@ -0,0 +1,7 @@
1
+ # Changelog
2
+
3
+ ## 0.1.3 - Nov 12 2018
4
+ - Added helper method `file_sha256(file)` to return the SHA256 of `file`'s content. This is useful for `null_resource` triggers.
5
+ - Fixed bug when file gets loaded before ERB parsed when using the `file` helper
6
+ ## 0.1.2 - Nov 11 2018
7
+ - Variables listed in JSON format inside file `terraform.tfvars.json` are accessible in rendered ERB as a HASH named `@variables` (with string keys).
data/README.md CHANGED
@@ -102,6 +102,8 @@ template = "${file("<%= f('files/userdata.tpl') %>")}"
102
102
 
103
103
  It is up to you to choose what you like. Try both and look inside `.tflat/main.tf` to see the difference between the two ways.
104
104
 
105
+ > You can also use `<%= file_sha256('path/to_file') %>` to return its SHA256.
106
+
105
107
  ## Installation
106
108
  1. [Download and install Terraform](https://www.terraform.io/intro/getting-started/install.html). Make sure the `terraform` command is in your **$PATH**.
107
109
 
@@ -3,6 +3,7 @@ require 'erb'
3
3
  require 'fileutils'
4
4
  require 'ptools'
5
5
  require 'json'
6
+ require 'digest'
6
7
 
7
8
  module Tflat
8
9
  class Terraform
@@ -67,8 +68,12 @@ module Tflat
67
68
  end
68
69
 
69
70
  def file(file)
70
- f = ".tflat/#{f(file)}"
71
- File.read(f).inspect[1...-1]
71
+ render(file).inspect[1...-1]
72
+ end
73
+
74
+ def file_sha256(ff)
75
+ f = file(ff)
76
+ Digest::SHA256.hexdigest(f)
72
77
  end
73
78
 
74
79
  def render(file)
@@ -1,3 +1,3 @@
1
1
  module Tflat
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tflat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paulo Arruda
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-11-12 00:00:00.000000000 Z
11
+ date: 2018-11-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ptools
@@ -78,6 +78,7 @@ files:
78
78
  - ".gitignore"
79
79
  - ".rspec"
80
80
  - ".travis.yml"
81
+ - CHANGELOG.md
81
82
  - CODE_OF_CONDUCT.md
82
83
  - Gemfile
83
84
  - Gemfile.lock