No-Code Provisioning API
The No-Code Provisioning API allows you to establish and configure a list of Terraform modules that you can use in no-code provisioning workflows within HCP Terraform. For more information on no-code modules, see Designing No-Code Ready Modules.
Allow No-Code Provisioning of a Module within an Organization
POST /organizations/:organization_name/no-code-modules
Parameter | Description |
---|---|
:organization_name | The name of the organization where no-code provisioning workflows should be allowed for this module. |
Each HCP Terraform organization has a list of which modules you can use to establish workspaces using no-code provisioning. You can use this API to enable no-code provisioning for a specific module. You can also use this API to set options for the allowed values of a variable for a no-code module in your organization.
Note: This endpoint can not be accessed with organization tokens. You must access it with a user token or team token.
Status | Response | Reason |
---|---|---|
200 | JSON API document (type: "no-code-modules" ) | Successfully enabled a module for no-code provisioning. |
404 | JSON API error object | Not found, or the user is unauthorized to perform this action. |
422 | JSON API error object | Malformed request body (e.g., missing attributes, wrong types, etc.). |
500 | JSON API error object | Internal system failure. |
Request Body
This POST endpoint requires a JSON object with the following properties as a request payload.
Properties without a default value are required.
Key path | Type | Default | Description |
---|---|---|---|
data.type | string | Must be "no-code-modules" . | |
data.attributes.version-pin | string | (latest version of the module) | The module version to use in no-code provisioning workflows. |
data.attributes.enabled | boolean | false | Set to true to enable no-code provisioning workflows. |
data.relationships.registry-module.data.id | string | The ID of a module in the organization's Private Registry. | |
data.relationships.registry-module.data.type | string | Must be "registry-module" . | |
data.relationships.variable-options.data[].type | string | Must be "variable-options" . | |
data.relationships.variable-options.data[].attributes.variable-name | string | The name of a variable within the module. | |
data.relationships.variable-options.data[].attributes.variable-type | string | The data type for the variable. Can be any type supported by Terraform. | |
data.relationships.variable-options.data[].attributes.options | Any[] | A list of allowed values for the variable. |
Sample Payload
{ "data": { "type": "no-code-modules", "attributes": { "version-pin": "1.0.1", "enabled": true }, "relationships": { "registry-module": { "data": { "id": "mod-2aaFrmRPZs2N9epr", "type": "registry-module" } }, "variable-options": { "data": [ { "type": "variable-options", "attributes": { "variable-name": "amis", "variable-type": "string", "options": [ "ami-1", "ami-2", "ami-3" ] } }, { "type": "variable-options", "attributes": { "variable-name": "region", "variable-type": "string", "options": [ "eu-north-1", "us-east-2", "us-west-1" ] } } ] } } }}
Sample Request
curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request POST \ --data @payload.json \ https://app.terraform.io/api/v2/organizations/hashicorp/no-code-modules
Sample Response
{ "data": { "id": "nocode-9HE91XDNY3faePn2", "type": "no-code-modules", "attributes": { "enabled": true, "version-pin": "1.0.1" }, "relationships": { "organization": { "data": { "id": "hashicorp", "type": "organizations" }, "links": { "related": "/api/v2/organizations/hashicorp" } }, "registry-module": { "data": { "id": "mod-2aaFrmRPZs2N9epr", "type": "registry-modules" }, "links": { "related": "/api/v2/registry-modules/mod-2aaFrmRPZs2N9epr" } }, "variable-options": { "data": [ { "id": "ncvaropt-fcHDfnZ1EGdRzFNC", "type": "variable-options" }, { "id": "ncvaropt-dZMfdh9KBcwFjyv2", "type": "variable-options" } ] } }, "links": { "self": "/api/v2/no-code-modules/nocode-9HE91XDNY3faePn2" } }}
Update No-Code Provisioning Settings for a Module
PATCH /no-code-modules/:id
Parameter | Description |
---|---|
:id | The unique identifier for a No-Code-Allowed module. |
Use this API to update the settings for the no-code provisioning of a module. You can use this API to:
- Enable or disable no-code provisioning
- Adjust the set of options for allowed variable values
- Change the module version being provisioned
- Change the module being provisioned
The API call that enables no-code provisioning for a module returns that module's unique identifier.
Note: This endpoint cannot be accessed with organization tokens. You must access it with a user token or team token.
Status | Response | Reason |
---|---|---|
200 | JSON API document (type: "no-code-modules" ) | Successfully updated a no-code module. |
404 | JSON API error object | Not found, or the user is unauthorized to perform this action. |
422 | JSON API error object | Malformed request body (e.g., missing attributes, wrong types, etc.). |
500 | JSON API error object | Internal system failure. |
Request Body
This PATCH endpoint requires a JSON object with the following properties as a request payload.
Properties without a default value are required.
Key path | Type | Default | Description |
---|---|---|---|
data.type | string | Must be "no-code-modules" . | |
data.attributes.version-pin | string | (previous value) | The module version to use in no-code provisioning workflows. |
data.attributes.enabled | boolean | (previous value) | Set to true to enable no-code provisioning workflows, or false to disable them. |
data.relationships.registry-module.data.id | string | (previous value) | The ID of a module in the organization's Private Registry. |
data.relationships.registry-module.data.type | string | (previous value) | Must be "registry-module" . |
data.relationships.variable-options.data[].id | string | (new value) | The ID of an existing variable-options set. If provided, a new variable-options set replaces the set with this ID. If not provided, this creates a new variable-option set. |
data.relationships.variable-options.data[].type | string | Must be "variable-options" . | |
data.relationships.variable-options.data[].attributes.variable-name | string | The name of a variable within the module. | |
data.relationships.variable-options.data[].attributes.variable-type | string | The data type for the variable. Can be any type supported by Terraform. | |
data.relationships.variable-options.data[].attributes.options | Any[] | A list of allowed values for the variable. |
Sample Payload
{ "data": { "type": "no-code-modules", "attributes": { "enabled": false }, "relationships": { "registry-module": { "data": { "id": "mod-zyai9dwH4VPPaVuC", "type": "registry-module" } }, "variable-options": { "data": [ { "id": "ncvaropt-fcHDfnZ1EGdRzFNC", "type": "variable-options", "attributes": { "variable-name": "Linux AMIs", "variable-type": "array", "options": [ "Xenial Xerus", "Trusty Tahr" ] } }, { "id": "ncvaropt-dZMfdh9KBcwFjyv2", "type": "variable-options", "attributes": { "variable-name": "region", "variable-type": "array", "options": [ "eu-north-1", "us-east-2", "us-west-1" ] } } ] } } }}
Sample Request
curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request PATCH \ --data @payload.json \ https://app.terraform.io/api/v2/no-code-modules/nocode-9HE91XDNY3faePn2
Sample Response
{ "data": { "id": "nocode-9HE91XDNY3faePn2", "type": "no-code-modules", "attributes": { "enabled": true, "version-pin": "1.0.1" }, "relationships": { "organization": { "data": { "id": "hashicorp", "type": "organizations" }, "links": { "related": "/api/v2/organizations/hashicorp" } }, "registry-module": { "data": { "id": "mod-2aaFrmRPZs2N9epr", "type": "registry-modules" }, "links": { "related": "/api/v2/registry-modules/mod-2aaFrmRPZs2N9epr" } }, "variable-options": { "data": [ { "id": "ncvaropt-fcHDfnZ1EGdRzFNC", "type": "variable-options" }, { "id": "ncvaropt-dZMfdh9KBcwFjyv2", "type": "variable-options" } ] } }, "links": { "self": "/api/v2/no-code-modules/nocode-9HE91XDNY3faePn2" } }}
Read a No-Code Module's Properties
GET /no-code-modules/:id
Parameter | Description |
---|---|
:id | The unique identifier for a No-Code-Allowed module. |
Use this API to read the details of an existing No-Code-Allowed module.
The API call that enables no-code provisioning for a module returns that module's unique identifier.
Status | Response | Reason |
---|---|---|
200 | JSON API document (type: "no-code-modules" ) | Successfully read the no-code module. |
400 | JSON API error object | Invalid include parameter. |
404 | JSON API error object | Not found, or the user is unauthorized to perform this action. |
422 | JSON API error object | Malformed request body (e.g., missing attributes, wrong types, etc.). |
500 | JSON API error object | Internal system failure. |
Query Parameters
This endpoint uses our standard URL query parameters. Remember to percent-encode [
as %5B
and ]
as %5D
if your tooling doesn't automatically encode URLs.
Parameter | Description |
---|---|
include | List related resource to include in the response. |
Available Related Resources
This GET endpoint can optionally return related resources if you request them with the include
query parameter. The following resource types are available:
Resource Name | Description |
---|---|
variable_options | Module variables with a configured set of allowed values. |
Sample Request
curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/no-code-modules/nocode-9HE91XDNY3faePn2?include=variable_options
Sample Response
{ "data": { "id": "nocode-9HE91XDNY3faePn2", "type": "no-code-modules", "attributes": { "enabled": true, "version-pin": "1.0.1" }, "relationships": { "organization": { "data": { "id": "hashicorp", "type": "organizations" }, "links": { "related": "/api/v2/organizations/hashicorp" } }, "registry-module": { "data": { "id": "mod-2aaFrmRPZs2N9epr", "type": "registry-modules" }, "links": { "related": "/api/v2/registry-modules/mod-2aaFrmRPZs2N9epr" } }, "variable-options": { "data": [ { "id": "ncvaropt-fcHDfnZ1EGdRzFNC", "type": "variable-options" }, { "id": "ncvaropt-dZMfdh9KBcwFjyv2", "type": "variable-options" } ] } }, "links": { "self": "/api/v2/no-code-modules/nocode-9HE91XDNY3faePn2" } }, "included": [ { "id": "ncvaropt-fcHDfnZ1EGdRzFNC", "type": "variable-options", "attributes": { "variable-name": "Linux AMIs", "variable-type": "array", "options": [ "Xenial Xerus", "Trusty Tahr" ] }, "relationships": { "no-code-allowed-module": { "data": { "id": "nocode-9HE91XDNY3faePn2", "type": "no-code-allowed-modules" } } } }, { "id": "ncvaropt-dZMfdh9KBcwFjyv2", "type": "variable-options", "attributes": { "variable-name": "region", "variable-type": "array", "options": [ "eu-north-1", "us-east-2", "us-west-1" ] }, "relationships": { "no-code-allowed-module": { "data": { "id": "nocode-9HE91XDNY3faePn2", "type": "no-code-allowed-modules" } } } } ]}