tfctl 1.4.0 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.bundle/config +1 -0
- data/.github/workflows/linter.yml +4 -1
- data/.github/workflows/release.yml +4 -5
- data/CHANGELOG.adoc +8 -0
- data/README.adoc +2 -1
- data/RELEASING.adoc +11 -5
- data/bin/tfctl +1 -1
- data/examples/control_tower/tfctl.yaml +2 -0
- data/lib/tfctl/generator.rb +7 -3
- data/lib/tfctl/schema.rb +2 -0
- data/lib/tfctl/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6a629291d80ced92fb46ec555c3eb0023b5b28defd031e457719f76a30bf9127
|
4
|
+
data.tar.gz: 2be23cc36e785f7fdae92c3717a7808b070549737682ecc26b02779b9cdc6489
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1a032960fc4809364bbe28cb85210713bc777b22d18c0041748c300c1e0a25fd01b4eb06bc242bfb880af10f3215c0776916ff32d80a40244d850eedaf514708
|
7
|
+
data.tar.gz: fb9337a42296df0fc17afe77f75cdb5a94c0d1569f94094d8b39d54e1e1b3beab1ba50976cafdebe90cacec5daac8e492ff610be2dd2f206ecbe0bb39f396e3c
|
data/.bundle/config
CHANGED
@@ -27,11 +27,10 @@ jobs:
|
|
27
27
|
env:
|
28
28
|
GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
|
29
29
|
- name: Release on GitHub
|
30
|
-
uses:
|
31
|
-
env:
|
32
|
-
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
30
|
+
uses: ncipollo/release-action@v1
|
33
31
|
with:
|
32
|
+
body: 'See [CHANGELOG](https://github.com/scalefactory/tfctl/blob/master/CHANGELOG.adoc) for details.'
|
33
|
+
token: "${{ secrets.GITHUB_TOKEN }}"
|
34
34
|
draft: false
|
35
35
|
prerelease: false
|
36
|
-
|
37
|
-
tag_name: '${{ github.ref }}'
|
36
|
+
artifacts: pkg/*.gem
|
data/CHANGELOG.adoc
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
= Changelog
|
2
2
|
|
3
|
+
== 1.5.0
|
4
|
+
|
5
|
+
* feat: support for setting default tags at AWS provider level. (Thanks @patrickli)
|
6
|
+
For details see: https://www.hashicorp.com/blog/default-tags-in-the-terraform-aws-provider
|
7
|
+
* feat: new `tf_state_prefix` config parameter. (Thanks @patrickli)
|
8
|
+
Allows setting an path prefix for state files stored in S3.
|
9
|
+
* feat: print version number in output log
|
10
|
+
|
3
11
|
== 1.4.0
|
4
12
|
|
5
13
|
* feat: support yaml anchors and aliases in configuration file.
|
data/README.adoc
CHANGED
@@ -20,7 +20,8 @@ endif::[]
|
|
20
20
|
|
21
21
|
= tfctl
|
22
22
|
|
23
|
-
image:https://
|
23
|
+
image:https://github.com/scalefactory/tfctl/actions/workflows/linter.yml/badge.svg["Linter", link="https://github.com/scalefactory/tfctl/actions/workflows/linter.yml"]
|
24
|
+
image:https://github.com/scalefactory/tfctl/actions/workflows/test.yml/badge.svg["Tests", link="https://github.com/scalefactory/tfctl/actions/workflows/test.yml"]
|
24
25
|
image:https://badge.fury.io/rb/tfctl.svg["Gem Version", link="https://badge.fury.io/rb/tfctl"]
|
25
26
|
image:https://img.shields.io/badge/terraform-0.12-blue.svg["Terraform 0.12", link="https://img.shields.io/badge/terraform-0.12-blue"]
|
26
27
|
|
data/RELEASING.adoc
CHANGED
@@ -6,8 +6,14 @@ releasing a new gem version.
|
|
6
6
|
== Process
|
7
7
|
|
8
8
|
* Smoke test in SF test accounts: https://github.com/scalefactory/tfctl-test
|
9
|
-
* Bump version in `lib/tfctl/version.rb
|
10
|
-
* Update `CHANGELOG.adoc
|
11
|
-
* Commit
|
12
|
-
*
|
13
|
-
|
9
|
+
* Bump version in `lib/tfctl/version.rb`.
|
10
|
+
* Update `CHANGELOG.adoc`.
|
11
|
+
* Commit.
|
12
|
+
* Tag the release using format: vX.X.X and push the tag.
|
13
|
+
|
14
|
+
----
|
15
|
+
git tag vX.X.X
|
16
|
+
git push origin vX.X.X
|
17
|
+
----
|
18
|
+
|
19
|
+
* GitHub actions will build and release the gem and create a GitHub release automatically.
|
data/bin/tfctl
CHANGED
@@ -138,7 +138,7 @@ begin
|
|
138
138
|
log_level = options[:debug] ? Logger::DEBUG : Logger::INFO
|
139
139
|
log = Tfctl::Logger.new(log_level)
|
140
140
|
|
141
|
-
log.info
|
141
|
+
log.info "tfctl #{Tfctl::VERSION} running"
|
142
142
|
|
143
143
|
config_name = File.basename(options[:config_file]).chomp('.yaml')
|
144
144
|
config_name = 'default' if config_name == 'tfctl'
|
@@ -13,6 +13,7 @@
|
|
13
13
|
#
|
14
14
|
|
15
15
|
tf_state_bucket: 'CHANGEME'
|
16
|
+
# tf_state_prefix: ''
|
16
17
|
tf_state_dynamodb_table: 'terraform-lock'
|
17
18
|
tf_state_region: 'eu-west-1'
|
18
19
|
# Role for accessing state resources
|
@@ -22,6 +23,7 @@ aws_provider_version: '>= 2.14'
|
|
22
23
|
# Role used by tfctl to retrieve data from AWS Organizations
|
23
24
|
# Has to be set up in the primary org account
|
24
25
|
tfctl_role_arn: 'arn:aws:iam::PRIMARY_ACCOUNT_ID:role/TfctlRole'
|
26
|
+
# default_tags: {}
|
25
27
|
|
26
28
|
#
|
27
29
|
# Data
|
data/lib/tfctl/generator.rb
CHANGED
@@ -16,6 +16,7 @@ module Tfctl
|
|
16
16
|
|
17
17
|
def make(account:, config:)
|
18
18
|
target_dir = "#{PROJECT_ROOT}/.tfctl/#{config[:config_name]}/#{account[:name]}"
|
19
|
+
tf_state_prefix = config.fetch(:tf_state_prefix, '').delete_suffix('/')
|
19
20
|
tf_version = config.fetch(:tf_required_version, '>= 0.12.29')
|
20
21
|
aws_provider_version = config.fetch(:aws_provider_version, '>= 2.14')
|
21
22
|
|
@@ -33,7 +34,7 @@ module Tfctl
|
|
33
34
|
'backend' => {
|
34
35
|
's3' => {
|
35
36
|
'bucket' => config[:tf_state_bucket],
|
36
|
-
'key' =>
|
37
|
+
'key' => [tf_state_prefix, account[:name], 'tfstate'].join('/').delete_prefix('/'),
|
37
38
|
'region' => config[:tf_state_region],
|
38
39
|
'role_arn' => config[:tf_state_role_arn],
|
39
40
|
'dynamodb_table' => config[:tf_state_dynamodb_table],
|
@@ -47,10 +48,13 @@ module Tfctl
|
|
47
48
|
provider_block = {
|
48
49
|
'provider' => {
|
49
50
|
'aws' => {
|
50
|
-
'region'
|
51
|
-
'assume_role'
|
51
|
+
'region' => account[:region],
|
52
|
+
'assume_role' => {
|
52
53
|
'role_arn' => "arn:aws:iam::#{account[:id]}:role/#{account[:tf_execution_role]}",
|
53
54
|
},
|
55
|
+
'default_tags' => {
|
56
|
+
'tags' => config.fetch(:default_tags, {}),
|
57
|
+
},
|
54
58
|
},
|
55
59
|
},
|
56
60
|
}
|
data/lib/tfctl/schema.rb
CHANGED
@@ -34,6 +34,7 @@ module Tfctl
|
|
34
34
|
'type' => 'object',
|
35
35
|
'properties' => {
|
36
36
|
'tf_state_bucket' => { 'type' => 'string' },
|
37
|
+
'tf_state_prefix' => { 'type' => 'string' },
|
37
38
|
'tf_state_role_arn' => {
|
38
39
|
'type' => 'string',
|
39
40
|
'pattern' => iam_arn_pattern,
|
@@ -48,6 +49,7 @@ module Tfctl
|
|
48
49
|
},
|
49
50
|
'data' => { 'type' => 'object' },
|
50
51
|
'exclude_accounts' => { 'type' => 'array' },
|
52
|
+
'default_tags' => { 'type' => 'object' },
|
51
53
|
'organization_root' => org_schema,
|
52
54
|
'organization_units' => org_schema,
|
53
55
|
'account_overrides' => org_schema,
|
data/lib/tfctl/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tfctl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Wasilczuk
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-06-
|
11
|
+
date: 2021-06-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-organizations
|