You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
to test plans and tasks against an inventory that I've created via pecdm
to run my plans and tasks using the --inventoryfile option. In other words, if have a test plan in /a/test/module and my pecdm inventory file lives beneath /my/peadm/gcp/inventory.yaml, then I want to be able to test my new hello plan with bolt by running cd /a/test/module && bolt plan run module::hello --inventoryfile=/my/peadm/gcp/inventory.yaml --targets=all. Curently this will not work because /my/peadm/gcp/inventory.yaml uses relative paths to the various terraform directories, e.g.,
Can we have some option to produce fullpaths as well?
Describe Alternatives You've Considered
I've created a ruby script to amend all my terraform inventory.yaml files so that I can achieve the above. For example, I added the following script to my PATH and then I run this from any GCP terraform inventory.yaml directories
#!/opt/puppetlabs/puppet/bin/rubyrequire'yaml'require'fileutils'# ABORT IF:# (1) current directory does not contain the inventory.yaml file# (2) inventory.yaml is not using terraform, i.e. no "_plugin: terraform" entriesabort("ERROR: current directory does not contain the inventory.yaml file")unlessFile.exist?('inventory.yaml')abort("INFO: inventory.yaml is not using the terraform plugin so no need to proceed")unlessFile.read('inventory.yaml').include?('_plugin: terraform')# ensure all "dir" entries contain fullpath to the directory containing the inventory.yaml filedirectory=File.expand_path(File.dirname('inventory.yaml'))File.open('inventory.yaml',"r+")do |file|
contents=file.readcontents.gsub!("dir: .terraform","dir: #{directory}/.terraform")contents.gsub!("dir: terraform","dir: #{directory}/terraform")file.rewindfile.write(contents)end
The text was updated successfully, but these errors were encountered:
Use Case
As a module developer, I want to be able
--inventoryfile
option. In other words, if have a test plan in/a/test/module
and my pecdm inventory file lives beneath/my/peadm/gcp/inventory.yaml
, then I want to be able to test my newhello
plan with bolt by runningcd /a/test/module && bolt plan run module::hello --inventoryfile=/my/peadm/gcp/inventory.yaml --targets=all
. Curently this will not work because/my/peadm/gcp/inventory.yaml
uses relative paths to the various terraform directories, e.g.,I believe that the above is generated via the inventory_yaml.epp
Describe the Solution You Would Like
Can we have some option to produce fullpaths as well?
Describe Alternatives You've Considered
I've created a ruby script to amend all my terraform inventory.yaml files so that I can achieve the above. For example, I added the following script to my PATH and then I run this from any GCP terraform inventory.yaml directories
The text was updated successfully, but these errors were encountered: