Provider Scaffolding (skaff)#
skaff
is a Terraform AWS Provider scaffolding command line tool.
It generates resource, data source, or function source files, along with test files which adhere to the latest best practices.
These files are heavily commented with instructions, serving as the best way to get started with provider development.
Overview workflow steps#
- Figure out what you're trying to do:
- Resource, data source, or function?
- Name it.
Tip
Net-new resources should be implemented with Terraform Plugin Framework (i.e. the default
skaff
settings). See Terraform Plugin Development Packages and this issue for additional information. - Use
skaff
to generate provider code. - Go through the generated code, customizing as necessary.
- Run, test, refine.
- Remove "TIP" comments.
- Submit a pull request.
Running skaff
#
- Clone the Terraform AWS Provider repository.
-
Install
skaff
.make skaff
-
Change into the appropriate directory.
- For resources and data sources, this is the service directory where the new entity will reside, e.g.
internal/service/mq
. - For functions, this is
internal/functions
.
- For resources and data sources, this is the service directory where the new entity will reside, e.g.
- Generate the resource, data source or function. For example,
skaff resource --name BrokerReboot
.skaff datasource --name IAMRole
.skaff function --name ARNParse
.
To get help, enter skaff
without arguments.
Usage#
Help#
skaff --help
Usage:
skaff [command]
Available Commands:
completion Generate the autocompletion script for the specified shell
datasource Create scaffolding for a data source
function Create scaffolding for a function
help Help about any command
resource Create scaffolding for a resource
Flags:
-h, --help help for skaff
Autocompletion#
Generate the autocompletion script for skaff
for the specified shell
skaff completion --help
Usage:
skaff completion [command]
Available Commands:
bash Generate the autocompletion script for bash
fish Generate the autocompletion script for fish
powershell Generate the autocompletion script for powershell
zsh Generate the autocompletion script for zsh
Flags:
-h, --help help for completion
Use "skaff completion [command] --help" for more information about a command
Data Source#
Create scaffolding for a data source
skaff datasource --help
Create scaffolding for a data source
Usage:
skaff datasource [flags]
Flags:
-c, --clear-comments do not include instructional comments in source
-f, --force force creation, overwriting existing files
-h, --help help for datasource
-t, --include-tags Indicate that this resource has tags and the code for tagging should be generated
-n, --name string name of the entity
-p, --plugin-sdkv2 generate for Terraform Plugin SDK V2
-s, --snakename string if skaff doesn't get it right, explicitly give name in snake case (e.g., db_vpc_instance)
Function#
Create scaffolding for a function.
skaff function --help
Create scaffolding for a function
Usage:
skaff function [flags]
Flags:
-c, --clear-comments do not include instructional comments in source
-d, --description string description of the function
-f, --force force creation, overwriting existing files
-h, --help help for function
-n, --name string name of the function
-s, --snakename string if skaff doesn't get it right, explicitly give name in snake case (e.g., arn_build)
Resource#
Create scaffolding for a resource
skaff resource --help
Create scaffolding for a resource
Usage:
skaff resource [flags]
Flags:
-c, --clear-comments do not include instructional comments in source
-f, --force force creation, overwriting existing files
-h, --help help for resource
-t, --include-tags Indicate that this resource has tags and the code for tagging should be generated
-n, --name string name of the entity
-p, --plugin-sdkv2 generate for Terraform Plugin SDK V2
-s, --snakename string if skaff doesn't get it right, explicitly give name in snake case (e.g., db_vpc_instance)