Skip to content

Commit

Permalink
docs and examples to trigger build (#134)
Browse files Browse the repository at this point in the history
  • Loading branch information
anubhavmishra authored Jul 4, 2020
1 parent d11afda commit dd54f88
Show file tree
Hide file tree
Showing 10 changed files with 318 additions and 36 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
## 0.0.7

- Support for `cdktf diff` (#90)
- Support for `cdktf deploy` (#92)
- Support for `cdktf destroy` (#111)
- Support for Terraform Cloud via `cdktf login` (#96)
- Support for logging across the project (#100)
- New UI for `cdktf synth` and `cdktf get` (#103)
- Basic error handling support (#110)

There are other minor bug fixes included in the release. (#109, #122, #128).

## 0.0.6

- Typescript examples and template defaults for synthesize commands to compile application (#63)
Expand Down
18 changes: 16 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,17 @@ HashiCorp Terraform.

## Overview

The CDK for Terraform project helps users define infrastructure resources using their programming language of choice and generates a Terraform configuration in JSON that can be applied with `terraform apply`.
The CDK for Terraform project helps users define infrastructure resources using supported programming languages and generates a Terraform configuration in JSON. Users can then use the Terraform or the CDK for Terraform CLI to deploy the application.

The project uses [AWS CDK](https://aws.amazon.com/cdk/) [constructs](https://github.com/aws/constructs) to define applications.

The CDK for Terraform project includes two packages:

* [cdktf-cli](./packages/cdktf-cli) - A CLI that allows users to run commands to initialize, import, and synthesize CDK for Terraform applications.
* [cdktf](./packages/cdktf-cli) - A library for defining Terraform resources using programming constructs.

The project currently supports TypeScript and Python.

## Getting Started

Choose a language:
Expand All @@ -36,11 +40,21 @@ Choose a language:

## Documentation

* [cdktf command-line interface](./docs/cli-commands.md).
* Explore the CDK for Terraform [CLI](./docs/cli-commands.md).
* Defining Terraform [outputs](./docs/working-with-cdk-for-terraform/terraform-outputs.md).
* Using Terraform [remote backend](./docs/working-with-cdk-for-terraform/remote-backend.md).
* Using the CDK for Terraform [escape hatch](./docs/working-with-cdk-for-terraform/escape-hatch.md).
* Using the CDK for Terraform [tokens](./docs/working-with-cdk-for-terraform/tokens.md).
* Using Teraform [data sources](./docs/working-with-cdk-for-terraform/data-sources.md).

## Contributing and Feedback

CDK for Terraform is an early experimental project and the development team would love your feedback to help guide the project.

* Contribute using the [CONTRIBUTING.md](./CONTRIBUTING.md) guide.
* Ask a question on the HashiCorp [Discuss](https://discuss.hashicorp.com/) using the [terraform-cdk](https://discuss.hashicorp.com/c/terraform-core/cdk-for-terraform/) category.
* Report a [bug](https://github.com/hashicorp/terraform-cdk/issues/new?assignees=&labels=bug&template=bug-report.md&title=) or request a new [feature](https://github.com/hashicorp/terraform-cdk/issues/new?assignees=&labels=enhancement&template=feature-request.md&title=).
* Browse all [open issues](https://github.com/hashicorp/terraform-cdk/issues).


## Building
Expand Down
204 changes: 185 additions & 19 deletions docs/cli-commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,19 @@ Help output:
cdktf [command]
Commands:
cdktf get [OPTIONS] Generate CDK Constructs for Terraform providers and modules.
cdktf init [OPTIONS] Create a new cdktf project from a template.
cdktf synth Synthesizes Terraform code for the given app in a directory. [aliases: synthesize]
cdktf deploy [OPTIONS] Deploy the given stack
cdktf destroy [OPTIONS] Destroy the given stack
cdktf diff [OPTIONS] Perform a diff (terraform plan) for the given stack
cdktf get [OPTIONS] Generate CDK Constructs for Terraform providers and modules.
cdktf init [OPTIONS] Create a new cdktf project from a template.
cdktf login Retrieves an API token to connect to Terraform Cloud.
cdktf synth [OPTIONS] Synthesizes Terraform code for the given app in a directory. [aliases: synthesize]
Options:
--version Show version number [boolean]
--help Show help [boolean]
--version Show version number [boolean]
--disable-logging Dont write log files. Supported using the env CDKTF_DISABLE_LOGGING. [boolean] [default: true]
--log-level Which log level should be written. Only supported via setting the env CDKTF_LOG_LEVEL [string]
-h, --help Show help [boolean]
Options can be specified via environment variables with the "CDKTF_" prefix (e.g. "CDKTF_OUTPUT")
```
Expand All @@ -36,6 +42,10 @@ Options can be specified via environment variables with the "CDKTF_" prefix (e.g
* [get](#cdktf-get)
* [init](#cdktf-init)
* [synth](#cdktf-synth)
* [diff](#cdktf-diff)
* [deploy](#cdktf-deploy)
* [destroy](#cdktf-destroy)
* [login](#cdktf-login)

### cdktf get

Expand All @@ -55,10 +65,12 @@ cdktf get [OPTIONS]
Generate CDK Constructs for Terraform providers and modules.
Options:
--version Show version number [boolean]
--help Show help [boolean]
--output, -o Output directory [string] [default: ".gen"]
--language, -l Output programming language [string] [required]
--version Show version number [boolean]
--disable-logging Dont write log files. Supported using the env CDKTF_DISABLE_LOGGING. [boolean] [default: true]
--log-level Which log level should be written. Only supported via setting the env CDKTF_LOG_LEVEL [string]
--output, -o Output directory for generated Constructs [string] [default: ".gen"]
--language, -l Output programming language [string] [required] [choices: "typescript", "python"]
-h, --help Show help [boolean]
```

Examples:
Expand Down Expand Up @@ -94,11 +106,16 @@ cdktf init [OPTIONS]
Create a new cdktf project from a template.
Options:
--version Show version number [boolean]
--help Show help [boolean]
--template The template name to be used to create a new project. [string] [required] [choices: "typescript"]
--dist Install dependencies from a "dist" directory (for development) [string]
--cdktf-version The cdktf version to use while creating a new project. [string] [default: "0.0.2-alpha.2"]
--version Show version number [boolean]
--disable-logging Dont write log files. Supported using the env CDKTF_DISABLE_LOGGING. [boolean] [default: true]
--log-level Which log level should be written. Only supported via setting the env CDKTF_LOG_LEVEL [string]
--template The template name to be used to create a new project. [string] [choices: "python", "typescript"]
--project-name The name of the project. [string]
--project-description The description of the project. [string]
--dist Install dependencies from a "dist" directory (for development) [string]
--local Use local remote state storage for generated Terraform. [boolean] [default: false]
--cdktf-version The cdktf version to use while creating a new project. [string] [default: "0.0.0"]
-h, --help Show help [boolean]
```

Examples:
Expand Down Expand Up @@ -126,15 +143,18 @@ $ cdktf synth --help
Help output:

```
cdktf synth
cdktf synth [OPTIONS]
Synthesizes Terraform code for the given app in a directory.
Options:
--version Show version number [boolean]
--help Show help [boolean]
--app, -a Command to use in order to execute cdktf app [required]
--output, -o Output directory [required] [default: "cdktf.out"]
--version Show version number [boolean]
--disable-logging Dont write log files. Supported using the env CDKTF_DISABLE_LOGGING. [boolean] [default: true]
--log-level Which log level should be written. Only supported via setting the env CDKTF_LOG_LEVEL [string]
--app, -a Command to use in order to execute cdktf app
--output, -o Output directory [default: "cdktf.out"]
--json Provide JSON output for the generated Terraform configuration. [boolean] [default: false]
-h, --help Show help [boolean]
```

Examples:
Expand All @@ -150,3 +170,149 @@ Synthesize code when providing a custom command to execute and an output directo
```bash
$ cdktf synth --app="npm compile && node main.js" --output="dirname"
```

Synthesize code for a given application and output the Terraform JSON configuration.

```bash
$ cdktf synth --json
```

### cdktf diff

This command generates a diff for a given application by running Terraform plan.

```bash
$ cdktf diff --help
```

Help output:

```
cdktf diff [OPTIONS]
Perform a diff (terraform plan) for the given stack
Options:
--version Show version number [boolean]
--disable-logging Dont write log files. Supported using the env CDKTF_DISABLE_LOGGING. [boolean] [default: true]
--log-level Which log level should be written. Only supported via setting the env CDKTF_LOG_LEVEL [string]
--app, -a Command to use in order to execute cdktf app [required]
--output, -o Output directory [required] [default: "cdktf.out"]
-h, --help Show help [boolean]
```

Examples:

Generate a diff for a given application.

```bash
$ cdktf diff
```

### cdktf deploy

This command deploys a given application.

```bash
$ cdktf deploy --help
```

Help output:

```
cdktf deploy [OPTIONS]
Deploy the given stack
Options:
--version Show version number [boolean]
--disable-logging Dont write log files. Supported using the env CDKTF_DISABLE_LOGGING. [boolean] [default: true]
--log-level Which log level should be written. Only supported via setting the env CDKTF_LOG_LEVEL [string]
--app, -a Command to use in order to execute cdktf app [required]
--output, -o Output directory [required] [default: "cdktf.out"]
--auto-approve Auto approve [boolean] [default: false]
-h, --help Show help [boolean]
```

Examples:

Deploy a given application.

```bash
$ cdktf deploy
```

Deploy a given application with auto approval of the diff (Terraform plan).

```bash
$ cdktf deploy --auto-approve
```

### cdktf destroy

This command destroys a given application.

```bash
$ cdktf destroy --help
```

Help output:

```
cdktf destroy [OPTIONS]
Destroy the given stack
Options:
--version Show version number [boolean]
--disable-logging Dont write log files. Supported using the env CDKTF_DISABLE_LOGGING. [boolean] [default: true]
--log-level Which log level should be written. Only supported via setting the env CDKTF_LOG_LEVEL [string]
--app, -a Command to use in order to execute cdktf app [required]
--output, -o Output directory [required] [default: "cdktf.out"]
--auto-approve Auto approve [boolean] [default: false]
-h, --help Show help [boolean]
```

Examples:

Destroy a given application.

```bash
$ cdktf destroy
```

Destroy a given application with auto approval of the diff (Terraform plan).

```bash
$ cdktf destroy --auto-approve
```

### cdktf login

This command helps login to Terraform Cloud by fetching a Terraform Cloud API token.

```bash
$ cdktf login --help
```

Help output:

```
cdktf login
Retrieves an API token to connect to Terraform Cloud.
Options:
--version Show version number [boolean]
--disable-logging Dont write log files. Supported using the env CDKTF_DISABLE_LOGGING. [boolean] [default: true]
--log-level Which log level should be written. Only supported via setting the env CDKTF_LOG_LEVEL [string]
-h, --help Show help [boolean]
```

Examples:

Fetch an API token from Terraform Cloud.

```bash
$ cdktf login
```
10 changes: 8 additions & 2 deletions docs/getting-started/python.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## Prerequisites

- [Terraform](https://www.terraform.io/downloads.html) >= v0.12
- [Node.js](https://nodejs.org) >= v12.16
- [Python](https://www.python.org/downloads/) >= v3.7
- [Pipenv](https://pipenv.pypa.io/en/latest/install/#installing-pipenv/)

Expand All @@ -19,10 +20,15 @@ Learn more how to use the cdktf command-line interface [here](../cli-commands.md
```bash
mkdir hello-terraform
cd hello-terraform
cdktf init --template="python"
cdktf init --template="python" --local
```
This will initialize a brand new CDK for Terraform project in Python using an interactive command.

This will initialize a brand new CDK for Terraform project in Python and install the `cdktf` library so that it can be used in the project.
```bash

```

Also, this command installs the `cdktf` library so that it can be used in the project.

## CDK for Terraform Application

Expand Down
Loading

0 comments on commit dd54f88

Please sign in to comment.