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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@c6fc/spellcraft-aws-terraform

v1.1.1

Published

A plugin to empower @c6fc/spellcraft with AWS and Terraform

Downloads

6

Readme

SpellCraft AWS Integration

NPM version License

This module exposes common constructs for using SpellCraft SpellFrames to deploy infrastructure to AWS using Terraform.

npm install --save @c6fc/spellcraft-aws-terraform

Features

This module exposes the concept of a bootstrap bucket (functionally a terraform backend), and artifacts which can contain arbitrary data and are stored alongside the terraform state in the bootstrap bucket. The former allows for dynamic configuration of Terraform providers within different environments, while the latter simplifies the storage and use of dynamic configuration details that might be environment dependent.

SpellFrame 'init()' features

This plugin does not perform any distinct 'init' operations, other than to initialize credentials within the dependant plugin @c6fc/terraform-aws-auth.

JavaScript context features

Extends the JavaScript function context with an awsterraform object containing the following keys:

{ 
	"projectName": "<contains the name of the project specified by bootstrap()>",
	"bootstrapBucket": "<contains the ARN for the bootstrap bucket>",
	"bootstrapLocation": "<contains the region where the bootstrap bucket is located>"
}

API Reference

bootstrap(project)

Creates a Terraform backend bucket if one doesn't already exist, then returns a 'backend' object referencing this bucket and a unique path for this project's state and artifacts.

  • param {string} project
  • returns {object} backend

Examples:

local aws = import "@c6fc/spellcraft-aws-terraform";

aws.bootstrap("myBootstrapTest");

// Returns:
{
   "terraform": {
       "backend": {
           "s3": {
               "bucket": "spellcraft-random-0123456789",
               "key": "spellcraft/myBootstrapTest/terraform.tfstate",
               "region": "us-east-1"
           }
       }
   }
}

getArtifact(name)

Obtains the contents of a named artifact stored alongside this project in the bootstrap bucket. This artifact is created with 'putArtifact';

  • param {string} name
  • returns {object} backend

Examples:

local aws = import "@c6fc/spellcraft-aws-terraform";

aws.getArtifact("myArtifact");

// Returns:
<contents of your artifact>

getBootstrapBucket()

Attempts to discover the bucket created through bootstrap(), returning the bucket ARN if present.

  • returns {string} bucketArn

Examples:

local aws = import "@c6fc/spellcraft-aws-terraform";

aws.getBootstrapBucket();

// Returns:
arn:aws:s3:::spellcraft-random-0123456789

getRemoteState(project)

Read the Terraform state for an adjacent SpellCraft project in the same AWS account

  • param {string} project
  • returns {object} state

Examples:

local aws = import "@c6fc/spellcraft-aws-terraform";

aws.getRemoteState("mySecondProject");

// Returns:
{ full remote state object }

putArtifact(name, content)

Stores the JSON-encoded balue of 'contents' as a file in the S3 backend bucket using the project prefix.

  • param {string} name
  • param {*} contents
  • returns {boolean} true

Examples:

local aws = import "@c6fc/spellcraft-aws-terraform";

aws.putArtifact("myArtifact", { someData: someValue });

// Returns:
true

providerAliases(default)

Stores the JSON-encoded balue of 'contents' as a file in the S3 backend bucket using the project prefix.

  • param {string} default
  • returns {object} terraformProviderConfig

Examples:

local aws = import "@c6fc/spellcraft-aws-terraform";

aws.providerAliases("us-east-2");

// Returns:
[{ aws: {
	region: "us-east-2"
}}, { aws: {
	region: "us-east-1",
			alias: "aws.us-east-1"
}}, ...]

Installation

Install the plugin as a dependency in your SpellCraft project:

npm install --save @c6fc/spellcraft-aws-terraform

Once installed, you can load the module into your JSonnet files.

local aws = import "@c6fc/spellcraft-aws-terraform";

{
	'backend.tf.json': aws.bootstrap("myProjectName"),
	'provider.tf.json': {
		provider: aws.providerAliases("us-west-2")
	}
}