Giter Club home page Giter Club logo

rspec-terraspace's People

Contributors

alexjfisher avatar exoemay avatar tongueroo avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

rspec-terraspace's Issues

rspec test generator broken by terraspace 2.2.7 release (worked in 2.2.6)

With latest terraspace and terraspace-rspec releases (2.2.7 and 0.3.2) bundle exec terraspace new test my_stack --type stack is broken.

/home/alex/.rvm/gems/ruby-3.1.2/gems/rspec-terraspace-0.3.2/lib/templates/stack/test/Gemfile.tt:4:in `template': undefined method `build_gemfile'

The build_gemfile helper still in use by rspec-terraspace here (and here) was removed in refactor done in boltops-tools/terraspace#312

Thanks,
Alex

`state_resource` helper can't return specific resources

This helper only seems to be usable in a very limited number of cases.

For example, if called with the name of a module as shown in the example here, it'll return the first resource in that module only.

I've spent some time trying to work on an improved version, but have got a bit stuck.

The code currently relies on terraform state pull and redirects the output into a file that is then parsed. This state doesn't contain the resource addresses and this makes it harder to extract specific resources.

If we used terraform show -json, the output will contain resource addresses that the helper could use instead. The output format is documented here.

And this is where I'm getting stuck.
run("show #{@mod.name} -json > #{state_path}") doesn't behave the same as run("state pull #{@mod.name} > #{state_path}")
The output doesn't get redirected to the file and gets displayed in the terminal only (leaving an empty file).

I'm assuming this is something to do with how terraspace show and terraspace state are implemented differently here??
(state has its own subclass)

Unfortunately, terraform show doesn't have any -out option, so redirecting the output (or consuming it directly) is the only option.
I think it is the correct interface to terraform though. From the docs terraform state show docs...

The output of terraform state show is intended for human consumption, not programmatic consumption. To extract state data for use in other software, use terraform show -json and decode the result using the documented structure.

If I could get this command to 'work' and capture the output via terraspace then I'm happy to work on updating and testing a new (or updated) state_resource helper.

Is this project alive?

I would very much like to use Rspec for testing, but this seems like a placeholder repository for now. Is that the case?

detect_type fails when Dir.pwd doesn't contain trailing slash

Hey, I've encountered an issue with an easy fix.

In project.rb, the detect_type function will fail if Dir.pwd does not contain a trailing slash (as is the case on my system). A simple ? after the slash in the regex fixes this issue.

md = dir.match(%r{app/(stacks|modules)/(.*)?/?})

If you want I can create a PR for this as well, unless you prefer a different solution.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.