Skip to content

Commit

Permalink
Merge pull request #784 from hashicorp/docs-add-cdktf-get-step
Browse files Browse the repository at this point in the history
fix(docs): add mandatory cdktf get step
  • Loading branch information
skorfmann authored Jun 17, 2021
2 parents 203c56a + a6f0dc3 commit e8f27ce
Show file tree
Hide file tree
Showing 5 changed files with 130 additions and 0 deletions.
26 changes: 26 additions & 0 deletions docs/getting-started/csharp.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,32 @@ namespace MyCompany.MyApp
}
```

## Using Terraform Providers

As you can see in the example above we want to deploy AWS resources, therefore we need to use the [Terraform AWS Provider](https://registry.terraform.io/providers/hashicorp/aws/latest/docs). Every [Terraform Provider](https://registry.terraform.io/browse/providers) and [Terraform Module](https://registry.terraform.io/browse/modules) can be used with the workflow described here.

You specify it in your local `cdktf.json` file, like this:

```jsonc
{
"language": "csharp",
"app": "dotnet run -p MyTerraformStack.csproj",
"terraformProviders": [
// Terraform Providers with version constraint go here
"aws@~> 3.45"
],
"terraformModules": [
// Terraform Modules with version constraint go here
],
"context": {
"excludeStackIdFromLogicalIds": "true"
}
}
```

Next you need to run `cdktf get` which generates provider-specific bindings.
To save some time you can also use pre-built provider, please visit the ["Using Providers and Modules"-Guide](../working-with-cdk-for-terraform/using-providers-and-modules.md) for more on that topic.

## Synthesize Application

When you are ready you can run the `synthesize` command to generate Terraform JSON configuration for the application.
Expand Down
26 changes: 26 additions & 0 deletions docs/getting-started/go.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,32 @@ JSII [is using pointers](https://github.com/aws/aws-cdk-rfcs/blob/master/text/20
to be able to represent an unset optional value as `nil`. Hence the helper functions `jsii.String()` and `jsii.Number()` are used
in the example to get pointers to the corresponding types which can are passed as inputs.

## Using Terraform Providers

As you can see in the example above we want to deploy AWS resources, therefore we need to use the [Terraform AWS Provider](https://registry.terraform.io/providers/hashicorp/aws/latest/docs). Every [Terraform Provider](https://registry.terraform.io/browse/providers) and [Terraform Module](https://registry.terraform.io/browse/modules) can be used with the workflow described here.

You specify it in your local `cdktf.json` file, like this:

```jsonc
{
"language": "go",
"app": "go run main.go",
"terraformProviders": [
// Terraform Providers with version constraint go here
"aws@~> 3.45"
],
"terraformModules": [
// Terraform Modules with version constraint go here
],
"context": {
"excludeStackIdFromLogicalIds": "true"
}
}
```

Next you need to run `cdktf get` which generates provider-specific bindings.
To save some time you can also use pre-built provider, please visit the ["Using Providers and Modules"-Guide](../working-with-cdk-for-terraform/using-providers-and-modules.md) for more on that topic.

## Generating Go provider bindings
For the above example to work, we need to add the `kreuzwerker/docker` Terraform provider to the `cdktf.json`.

Expand Down
26 changes: 26 additions & 0 deletions docs/getting-started/java.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,32 @@ public class Main extends TerraformStack
}
```

## Using Terraform Providers

As you can see in the example above we want to deploy AWS resources, therefore we need to use the [Terraform AWS Provider](https://registry.terraform.io/providers/hashicorp/aws/latest/docs). Every [Terraform Provider](https://registry.terraform.io/browse/providers) and [Terraform Module](https://registry.terraform.io/browse/modules) can be used with the workflow described here.

You specify it in your local `cdktf.json` file, like this:

```jsonc
{
"language": "java",
"app": "mvn -e -q compile exec:java",
"terraformProviders": [
// Terraform Providers with version constraint go here
"aws@~> 3.45"
],
"terraformModules": [
// Terraform Modules with version constraint go here
],
"context": {
"excludeStackIdFromLogicalIds": "true"
}
}
```

Next you need to run `cdktf get` which generates provider-specific bindings.
To save some time you can also use pre-built provider, please visit the ["Using Providers and Modules"-Guide](../working-with-cdk-for-terraform/using-providers-and-modules.md) for more on that topic.

## Synthesize Application

When you are ready you can run the `synthesize` command to generate Terraform JSON configuration for the application.
Expand Down
26 changes: 26 additions & 0 deletions docs/getting-started/python.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,32 @@ MyStack(app, "hello-terraform")
app.synth()
```

## Using Terraform Providers

As you can see in the example above we want to deploy AWS resources, therefore we need to use the [Terraform AWS Provider](https://registry.terraform.io/providers/hashicorp/aws/latest/docs). Every [Terraform Provider](https://registry.terraform.io/browse/providers) and [Terraform Module](https://registry.terraform.io/browse/modules) can be used with the workflow described here.

You specify it in your local `cdktf.json` file, like this:

```jsonc
{
"language": "python",
"app": "pipenv run python main.py",
"terraformProviders": [
// Terraform Providers with version constraint go here
"aws@~> 3.45"
],
"terraformModules": [
// Terraform Modules with version constraint go here
],
"context": {
"excludeStackIdFromLogicalIds": "true"
}
}
```

Next you need to run `cdktf get` which generates provider-specific bindings.
To save some time you can also use pre-built provider, please visit the ["Using Providers and Modules"-Guide](../working-with-cdk-for-terraform/using-providers-and-modules.md) for more on that topic.

## Synthesize Application

When you are ready you can run the `synthesize` command to generate Terraform JSON configuration for the application.
Expand Down
26 changes: 26 additions & 0 deletions docs/getting-started/typescript.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,32 @@ new MyStack(app, "hello-terraform");
app.synth();
```

## Using Terraform Providers

As you can see in the example above we want to deploy AWS resources, therefore we need to use the [Terraform AWS Provider](https://registry.terraform.io/providers/hashicorp/aws/latest/docs). Every [Terraform Provider](https://registry.terraform.io/browse/providers) and [Terraform Module](https://registry.terraform.io/browse/modules) can be used with the workflow described here.

You specify it in your local `cdktf.json` file, like this:

```jsonc
{
"language": "typescript",
"app": "npm run --silent compile && node main.js",
"terraformProviders": [
// Terraform Providers with version constraint go here
"aws@~> 3.45"
],
"terraformModules": [
// Terraform Modules with version constraint go here
],
"context": {
"excludeStackIdFromLogicalIds": "true"
}
}
```

Next you need to run `cdktf get` which generates provider-specific bindings.
To save some time you can also use pre-built provider, please visit the ["Using Providers and Modules"-Guide](../working-with-cdk-for-terraform/using-providers-and-modules.md) for more on that topic.

**Synthesize Application**

When you are ready you can run the `synthesize` command to generate Terraform JSON configuration for the application.
Expand Down

0 comments on commit e8f27ce

Please sign in to comment.