Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
What's new
4
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
Menu
Open sidebar
rlees85-ruby
terraform-wrapper
Commits
90b49a88
Commit
90b49a88
authored
Mar 10, 2021
by
Rich
Browse files
Update config schema to allow variables per code
parent
33791f33
Changes
4
Hide whitespace changes
Inline
Side-by-side
archlinux/PKGBUILD
View file @
90b49a88
...
...
@@ -3,7 +3,7 @@
_gemname
=
terraform-wrapper
pkgname
=
ruby-
${
_gemname
}
pkgver
=
1.
0.3
pkgver
=
1.
1.0
pkgrel
=
1
pkgdesc
=
"A ruby wrapper for managing Terraform binaries and remote state."
arch
=(
any
)
...
...
lib/terraform-wrapper/shared/config.rb
View file @
90b49a88
...
...
@@ -75,15 +75,28 @@ module TerraformWrapper
logger
.
fatal
(
"Invalid YAML in configuration file:
#{
@path
}
"
)
unless
yaml
.
kind_of?
(
Hash
)
identifiers
=
yaml
.
key?
(
"identifiers"
)
?
yaml
[
"identifiers"
]
:
Hash
.
new
@variables
=
TerraformWrapper
::
Shared
::
Variables
.
new
(
config:
@name
,
component:
@code
.
name
,
service:
@service
,
identifiers:
identifiers
)
@variables
.
add_variables
(
variables:
yaml
[
"globals"
])
if
yaml
.
key?
(
"globals"
)
@variables
=
TerraformWrapper
::
Shared
::
Variables
.
new
(
config:
@name
,
component:
@code
.
name
,
service:
@service
,
identifiers:
identifiers
)
if
yaml
.
key?
(
"globals"
)
then
logger
.
fatal
(
"Key 'globals' is not a hash in configuration file:
#{
@path
}
"
)
unless
yaml
[
"globals"
].
kind_of?
(
Hash
)
globals
=
yaml
[
"globals"
]
@variables
.
add_variables
(
variables:
globals
[
"variables"
])
if
globals
.
key?
(
"variables"
)
end
if
yaml
.
key?
(
"terraform"
)
then
logger
.
fatal
(
"Key 'terraform' is not a hash in configuration file:
#{
@path
}
"
)
unless
yaml
[
"terraform"
].
kind_of?
(
Hash
)
terraform
=
yaml
[
"terraform"
]
@variables
.
add_variables
(
variables:
terraform
[
"variables"
])
if
terraform
.
key?
(
"variables"
)
@variables
.
add_files
(
base:
@base
,
files:
terraform
[
"files"
])
if
terraform
.
key?
(
"files"
)
[
"globals"
,
@code
.
name
].
each
do
|
extra
|
if
terraform
.
key?
(
extra
)
then
logger
.
fatal
(
"Key '
#{
extra
}
' under 'terraform' is not a hash in configuration file:
#{
@path
}
"
)
unless
terraform
[
extra
].
kind_of?
(
Hash
)
section
=
terraform
[
extra
]
@variables
.
add_variables
(
variables:
section
[
"variables"
])
if
section
.
key?
(
"variables"
)
@variables
.
add_files
(
base:
@base
,
files:
section
[
"files"
])
if
section
.
key?
(
"files"
)
end
end
end
@auths
=
Array
.
new
...
...
lib/terraform-wrapper/tasks/upgrade.rb
View file @
90b49a88
...
...
@@ -34,7 +34,7 @@ module TerraformWrapper
def
upgrade_task
desc
"Upgrades the Terraform infrastructure component modules, providers and lock file."
task
:upgrade
=>
:binary
do
|
t
,
args
|
task
:upgrade
=>
[
:binary
,
:clean
]
do
|
t
,
args
|
runner
=
TerraformWrapper
::
Shared
::
Runner
.
new
(
binary:
@binary
,
code:
@code
)
logger
.
info
(
"Upgrading Terraform component:
#{
@code
.
name
}
..."
)
...
...
lib/terraform-wrapper/version.rb
View file @
90b49a88
...
...
@@ -4,7 +4,7 @@ module TerraformWrapper
###############################################################################
VERSION
=
"1.
0.3
"
VERSION
=
"1.
1.0
"
###############################################################################
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment