# csfn

> CoffeeScript + CloudFormation = CoffeeScriptFormation -> csfn

Latest version **1.0.1** (published 2014-07-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install csfn
pnpm add csfn
yarn add csfn
bun add csfn
```

Provides the command `csfn`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2014-07-29 |
| First published | 2014-07-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 12 |
| Maintainers | j3tm0t0 |
| Keywords | AWS, CloudFormation, CoffeeScript |

## Links

- npm: https://www.npmjs.com/package/csfn
- Repository: https://github.com/j3tm0t0/csfn
- Issues: https://github.com/j3tm0t0/csfn/issues
- npm.io page: https://npm.io/package/csfn

## Dependencies (1)

- [coffee-script](https://npm.io/package/coffee-script.md) *

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2014-07-29
- 1.0.0 — 2014-07-07

## README

csfn
====

CoffeeScript + CloudFormation = CoffeeScriptFormation -> csfn

## installation
```
$ npm install -g csfn
```

## usage
```
$ csfn
usage: csfn hoge.coffee [ puge.coffee ... ] > hogepuge.template
 or aws cloudformation create-stack --stack-name STACKNAME --template-body "$(csfn hoge.coffee)"

# just convert .coffee to template json

$ cat bucket.coffee
Resources.Bucket=
  Type:"AWS::S3::Bucket"
  Properties:
    BucketName: "my-special-bucket"

$ csfn bucket.coffee
{
  "AWSTemplateFormatVersion": "2010-09-09",
  "Resources": {
    "Bucket": {
      "Type": "AWS::S3::Bucket",
      "Properties": {
        "BucketName": "my-special-bucket"
      }
    }
  }
}

# create stack directly from command line by using AWS CLI
$ aws cloudformation create-stack --stack-name mybucket --template-body "$(csfn bucket.coffee)"
arn:aws:cloudformation:ap-northeast-1:123456789012:stack/mybucket/5de182a0-fe91-11e3-92e7-5088487c4896

```

## what you can do with csfn
+ You can write templates more simple way (without tons of {} and ,)
+ You can put comments in the template
+ You can use here document (handy for cloud-init userscript)

```
commands = '''
#!/bin/sh
yum install -y httpd
service httod start
chkconfig httpd on
'''

:

Resources.Webserver=
  Type: "AWS::EC2::Instance"
  Proprerties:
     :
    UserData: "Fn::Base64":command
```
+ You can use loop!

```
# 1 Master
Resources.Master=
  Type: "AWS::RDS::DBInstance"
  Properties:
    AllocatedStorage: 5
    DBInstanceClass: "db.t1.micro"
    Engine: "mysql"
    EngineVersion: "5.6.17"
    MasterUsername: "admin"
    MasterUserPassword: "password"

# 5 x Read Replicas
for i in [1..5]
  Resources["Slave"+i]=
    Type: "AWS::RDS::DBInstance"
    Properties:
      SourceDBInstanceIdentifier: "Ref":"Master"
```

---
_Source: https://npm.io/package/csfn · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
