Skip to content

Commit

Permalink
feat(terraform): Added providers command (#186)
Browse files Browse the repository at this point in the history
Terraform:
- Added terraform providers command
- Readme has been extended with terraform commands and options

@TriPSs Could you take a look? Adding the provider command for terraform
makes sense in my opinion. I have also extended the terraform readme.
  • Loading branch information
TriPSs authored Dec 1, 2023
2 parents 14059cd + 03cc6d2 commit 7190c5a
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 0 deletions.
23 changes: 23 additions & 0 deletions packages/terraform/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,29 @@ nx g @nx-extend/terraform:init

## Usage

### Setup
```sh
nx g @nx-extend/terraform:init
```

#### Available options:

| name | type | required | default | description |
|-------------------|----------|----------|---------|------------------------------------------------------------------|
| **`--name`** | `string` | `true` | | Terraform project name |
| **`--directory`** | `string` | `false` | | A directory where the project is placed, based on the sourceRoot |
| **`--tags`** | `string` | `false` | `empty` | Comma separated list for tags |

### Terraform execution

```sh
nx run <terraform-project-name>:initialize
nx run <terraform-project-name>:providers
nx run <terraform-project-name>:plan
nx run <terraform-project-name>:apply
nx run <terraform-project-name>:destroy
```

#### Available options:

| name | type | default | description |
Expand Down
10 changes: 10 additions & 0 deletions packages/terraform/executors.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@
"implementation": "./src/executors/destroy/destroy.impl",
"schema": "./src/executors/destroy/schema.json",
"description": "destroy executor"
},
"providers": {
"implementation": "./src/executors/providers/providers.impl",
"schema": "./src/executors/providers/schema.json",
"description": "providers executor"
}
},
"builders": {
Expand Down Expand Up @@ -51,6 +56,11 @@
"implementation": "./src/executors/destroy/destroy.impl",
"schema": "./src/executors/destroy/schema.json",
"description": "destroy executor"
},
"providers": {
"implementation": "./src/executors/providers/providers.impl",
"schema": "./src/executors/providers/schema.json",
"description": "providers executor"
}
}
}
5 changes: 5 additions & 0 deletions packages/terraform/src/executors/providers/compat.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { convertNxExecutor } from '@nx/devkit'

import providersExecutor from './providers.impl'

export default convertNxExecutor(providersExecutor)
3 changes: 3 additions & 0 deletions packages/terraform/src/executors/providers/providers.impl.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { createExecutor } from '../../utils/create-executor'

export default createExecutor('providers')
9 changes: 9 additions & 0 deletions packages/terraform/src/executors/providers/schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"version": 2,
"outputCapture": "direct-nodejs",
"$schema": "http://json-schema.org/schema",
"type": "object",
"title": "Providers executor",
"description": "Providers",
"properties": {}
}
6 changes: 6 additions & 0 deletions packages/terraform/src/generators/init/init.impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ export default async function (
ciMode: true
}
},
providers: {
executor: '@nx-extend/terraform:providers',
options: {
ciMode: true
}
},
apply: {
executor: '@nx-extend/terraform:apply',
options: {
Expand Down

0 comments on commit 7190c5a

Please sign in to comment.