npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

recink-terraform

v2.4.4

Published

REciNK Component for Terraform

Downloads

13

Readme

REciNK Component for Terraform

This is a REciNK component for Terraform.

Prerequisites

  • [x] Git >= v1.x
  • [x] Node.js >= v6.x
  • [x] NPM >= v3.x
  • [x] REciNK

Use nvm to install and manage different versions of Node.js; Ideally, use v8+ for faster performance

Installation

  • npm install -g recink-terraform
  • npm install -g recink-comment Only necessary when GitHub commenting support needed

Note that the component is installed automatically when running recink component add terraform

Configuration

.recink.yml configuration:

$:
  preprocess:
    '$.terraform.vars.sample': 'eval'
    '$.comment.providers.github.0.token': 'eval'
  terraform:
    version: '0.11.0'                                                       # Terraform version that will be downloaded and installed locally (default "0.11.0")
    cache: true                                                             # Enable state/plans/backups caching if cache component enabled (default "true")
    resource: '.resource'                                                   # Resource relative path to the module root directory (default ".resource")
    binary: './bin/terraform'                                               # Path to Terraform binary (default "./bin/terraform")
    init: true                                                              # Initialize Terraform setup (default "true")
    plan: true                                                              # Terraform validate .tf and make a provision plan (default "true")
    apply: false                                                            # Terraform provision infrastructure (default "false")
    destroy: false                                                          # Terraform destroy infrastructure provisioned in previous step (default "false")
    vars:                                                                   # Terraform variables (@see https://www.terraform.io/docs/configuration/variables.html)
      sample: 'process.env.SAMPLE_VAR'
    var-files:                                                              # Terraform variables files (@see https://www.terraform.io/docs/configuration/variables.html#variable-files)
      - foo.tfvars
      - bar.tfvars
  comment:
    providers:                                                              # Supported providers: github
      github:
        - token: 'process.env.GITHUB_TOKEN'

.travis.yml configuration:

script: 'recink run terraform -c comment'  
before_install:
  # other before_install scripts...
  - 'npm install -g recink-terraform'
  - 'npm install -g recink-comment'

Add the SAMPLE_VAR and GITHUB_TOKEN to .travis.yml:

recink travis encrypt -x 'SAMPLE_VAR="sample value"' -x 'GITHUB_TOKEN=xxxxxxx'

If you are using Travis Pro read this guide to properly encrypt the environment variable

Per module settings

You can control the recink-terraform behavior using per module configuration feature as simple as shown in the example below:

example_prepare:
  root: './prepare'                         # Module root folder containing "main.tf" file inside
example_module:
  root: './example'                         # Module root folder containing "main.tf" file inside
  terraform:
    run-after:                              # Other Terraform modules to run before dispatching "example_module"
      - example_prepare
    dependencies:                           # Global dependencies that should be considered when mathing changeset
      - '../../global-modules'
    vars:                                   # Local module variables and global overwrites
      sample: 'overwrite default value!'
      new_one: 'define a new variable here.'
    var-files:                              # Terraform variables files (pay attention to the order)
      - foo.tfvars
      - bar.tfvars

terraform.dependencies key is available as local module configuration option only and matches the changed files affecting the module that allows Terraform commands to be launched on global modules changes.

run-after key is available as local module configuration option only and allows running desired Terraform modules after other modules dispatched (e.g. run example_prepare before starting example_module)

Usage

SAMPLE_VAR="sample value" GITHUB_TOKEN=xxxxxxx recink run terraform -c comment

Running example project

The following example will create 2 AWS VPCs with a peering connection between them:

AWS_DEFAULT_REGION='${region}' AWS_ACCESS_KEY_ID='${access-key-id}' AWS_SECRET_ACCESS_KEY='${secret-access-key}' recink run terraform example/

Note that example/ directory is relative to the recink-terraform module root.

How it works

REciNK and is listening for modules configured in .recink.yml (@see example) having a ${module.root}/main.tf file inside and triggering the configured operations (e.g. terraform init, terraform plan, terraform apply and terraform destroy).

Gotchas

  • If recink-comment is neither installed or configured the reporter will fall back to logger.info() and output the message in console