forked from TerraStackIO/terrastack
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 4b3e6a8
Showing
62 changed files
with
199,489 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
**/**/node_modules | ||
.dockerignore | ||
Dockerfile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
name: Bug report | ||
about: Create a report to help us improve | ||
title: "[BUG] new bug" | ||
labels: bug | ||
assignees: '' | ||
|
||
--- | ||
|
||
**Describe the bug** | ||
A clear and concise description of what the bug is. | ||
|
||
**To Reproduce** | ||
Steps to reproduce the issue. | ||
|
||
**Expected behavior** | ||
A clear and concise description of what you expected to happen. | ||
|
||
**Additional context** | ||
Add any other context about the problem here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
name: Feature request / suggestion | ||
about: Suggest an idea for this project | ||
title: "[Suggestion] new suggestion" | ||
labels: enhancement | ||
assignees: '' | ||
|
||
--- | ||
|
||
**Is your feature request related to a problem? Please describe.** | ||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] | ||
|
||
**Describe the solution you'd like** | ||
A clear and concise description of what you want to happen. | ||
|
||
**Describe alternatives you've considered** | ||
A clear and concise description of any alternative solutions or features you've considered. | ||
|
||
**Additional context** | ||
Add any other context or screenshots about the feature request here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
name: Build | ||
on: [pull_request] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
container: | ||
image: jsii/superchain | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- run: yarn install | ||
- run: yarn build | ||
- run: yarn test | ||
- run: yarn package |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: Release @next | ||
on: | ||
push: | ||
branches: | ||
- none | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
container: | ||
image: jsii/superchain | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- run: yarn install | ||
- run: tools/align-version.sh "-pre.${{ github.sha }}" | ||
- run: yarn build | ||
- run: yarn test | ||
- run: yarn package | ||
|
||
# publish to package managers only if this is a new version | ||
- run: npx jsii-release-npm | ||
env: | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
NPM_DIST_TAG: next |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: Release | ||
on: | ||
push: | ||
branches: | ||
- none | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
container: | ||
image: jsii/superchain | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- run: yarn install | ||
- run: tools/align-version.sh | ||
- run: yarn build | ||
# - run: yarn test | ||
- run: yarn package | ||
|
||
# publish to package managers only if this is a new version | ||
- run: yarn release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
MAVEN_GPG_PRIVATE_KEY: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} | ||
MAVEN_GPG_PRIVATE_KEY_PASSPHRASE: ${{ secrets.MAVEN_GPG_PRIVATE_KEY_PASSPHRASE }} | ||
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} | ||
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} | ||
MAVEN_STAGING_PROFILE_ID: ${{ secrets.MAVEN_STAGING_PROFILE_ID }} | ||
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} | ||
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }} | ||
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
dist/ | ||
.gen | ||
.generated | ||
.vscode/ | ||
|
||
cdk.out | ||
*.d.ts | ||
*.js | ||
|
||
# Created by https://www.gitignore.io/api/node | ||
# Edit at https://www.gitignore.io/?templates=node | ||
|
||
### Node ### | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
lerna-debug.log* | ||
|
||
# Diagnostic reports (https://nodejs.org/api/report.html) | ||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
*.lcov | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
|
||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# Bower dependency directory (https://bower.io/) | ||
bower_components | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (https://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directories | ||
node_modules/ | ||
jspm_packages/ | ||
|
||
# TypeScript v1 declaration files | ||
typings/ | ||
|
||
# TypeScript cache | ||
*.tsbuildinfo | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional eslint cache | ||
.eslintcache | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# Output of 'npm pack' | ||
*.tgz | ||
|
||
# Yarn Integrity file | ||
.yarn-integrity | ||
|
||
# dotenv environment variables file | ||
.env | ||
.env.test | ||
|
||
# parcel-bundler cache (https://parceljs.org/) | ||
.cache | ||
|
||
# next.js build output | ||
.next | ||
|
||
# nuxt.js build output | ||
.nuxt | ||
|
||
# vuepress build output | ||
.vuepress/dist | ||
|
||
# Serverless directories | ||
.serverless/ | ||
|
||
# FuseBox cache | ||
.fusebox/ | ||
|
||
# DynamoDB Local files | ||
.dynamodb/ | ||
|
||
# End of https://www.gitignore.io/api/node | ||
|
||
# Created by https://www.gitignore.io/api/terraform | ||
# Edit at https://www.gitignore.io/?templates=terraform | ||
|
||
### Terraform ### | ||
# Local .terraform directories | ||
**/.terraform/* | ||
|
||
# .tfstate files | ||
*.tfstate | ||
*.tfstate.* | ||
|
||
# Crash log files | ||
crash.log | ||
|
||
# Ignore any .tfvars files that are generated automatically for each Terraform run. Most | ||
# .tfvars files are managed as part of configuration and so should be included in | ||
# version control. | ||
# | ||
# example.tfvars | ||
|
||
# Ignore override files as they are usually used to override resources locally and so | ||
# are not checked in | ||
override.tf | ||
override.tf.json | ||
*_override.tf | ||
*_override.tf.json | ||
|
||
# Include override files you do wish to add to version control using negated pattern | ||
# !example_override.tf | ||
|
||
# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan | ||
# example: *tfplan* | ||
|
||
# End of https://www.gitignore.io/api/terraform |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Changelog | ||
|
||
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. | ||
|
||
## 0.15.0 (2020-03-11) | ||
|
||
## 0.14.0 (2020-03-11) | ||
|
||
## 0.13.0 (2020-03-11) | ||
|
||
## 0.12.0 (2020-03-11) | ||
|
||
## 0.11.0 (2020-03-11) | ||
|
||
## 0.10.0 (2020-03-11) | ||
|
||
## 0.10.0 (2020-03-11) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# Terrastack - Polyglot Terraform supercharged by the CDK | ||
|
||
Terrastack enables you to keep using Terraform as engine, while defining your resources in actual programming languages such as Typescript, Python, Java or C# - with more to come ([perhaps Ruby?](https://github.com/aws/jsii/issues/144)). | ||
|
||
This is made possible by the [Cloud Development Kit (CDK)](https://github.com/aws/aws-cdk/) and [jsii](https://github.com/aws/jsii) for generating the polyglot libraries. While the major use-case for the CDK is generating Cloudformation configuration as YAML, it's capable of generating pretty much any configuration. | ||
|
||
Applying it Terraform was inspired by the release of [cdk8s](https://github.com/awslabs/cdk8s), which also paved the way for rapid progress towards a working Terraform version. | ||
|
||
## How does it work? | ||
|
||
Terrastack makes use of the following things: | ||
|
||
- Terraform [provider schemas](https://www.terraform.io/docs/commands/providers/schema.html) - See [an example](./examples/provider-schema) | ||
- Besides from HCL, Terraform [understands JSON as well](https://www.terraform.io/docs/configuration/syntax-json.html) | ||
- [Code generator](./packages/terrastack-cli) to transform the provider schema in proper Typescript classes | ||
- A custom [Stack](./packages/@terrastack/core/lib/stack.ts) and [ResourceObject](./packages/@terrastack/core/lib/resource-object.ts) class to interface with the CDK | ||
|
||
With that, we're able to generate packages for any given Terraform provider in the following languages: | ||
|
||
- Typescript ([tested](./examples/simple)) | ||
- Python ([tested](./examples/simple-python)) | ||
- C# (yet to test) | ||
- Java (yet to test) | ||
|
||
## Current Status | ||
|
||
In the current state, this is mostly a prototype. It demonstrates that it's possible and quite useful to leverage the CDK. Interfaces and Apis will certainly change and there are still some problems to solve. | ||
|
||
However, it's possible to generate full bindings for a given Terraform provider (tested with AWS and Google Cloud so far). | ||
|
||
## Roadmap | ||
|
||
- [x] Generate Terraform constructs (Level 1 in CDK speak) from the Terraform JSON schema | ||
- [x] Build Terraform stacks out of those resources in Typescript, Python, Java or C# | ||
- [x] Reference resources within a stack | ||
- [x] Synthesize valid Terraform JSON which is plannable and applyable | ||
- [x] Leverage existing CDK packages which are not bound to cloudformation directly, such as global tagging or an IAM Policy builder | ||
- [ ] Multiple Stacks with individual state | ||
- [ ] Input Variables | ||
- [ ] Outputs | ||
- [ ] Remote State | ||
- [ ] Pregenerate schemas for Terraform Providers | ||
- [ ] Built-in functions | ||
- [ ] Generic resource features such as lifecycles and dependencies | ||
- [ ] Modules | ||
- [ ] Dynamic blocks | ||
- [ ] count / for each | ||
- [ ] Converting HCL to Terrastack resources | ||
- [ ] Publish easy consumable packages for providers and open source modules | ||
- [ ] Better Terraform integration | ||
- [ ] More examples |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Generate Terraform Provider Schema | ||
|
||
Starting from Terraform `0.12` you can use the Terraform CLI to generate a JSON representation of a given provider. Find the details and spec [over here](https://www.terraform.io/docs/commands/providers/schema.html) | ||
|
||
### AWS Provider Example | ||
|
||
Get the provider version you want and edit [./aws.tf.json](./aws.tf.json) accordingly. | ||
|
||
Find available versions like this | ||
|
||
```bash | ||
curl -s https://registry.terraform.io/v1/providers/hashicorp/aws/versions | jq -r '.versions | .[] | .version' | ||
``` | ||
|
||
The run the following | ||
|
||
```bash | ||
terraform init | ||
terraform providers schema -json | jq > schema.json | ||
``` | ||
Inspect the schema | ||
|
||
```bash | ||
cat schema.json | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"provider": { | ||
"aws": { | ||
"version": "2.52.0" | ||
}, | ||
"google": { | ||
"version": "3.11.0" | ||
} | ||
} | ||
} |
Oops, something went wrong.