How would I deploy a Marketplace item in terraform?


I was wondering if it is possible to deploy a marketplace item with terraform.

For example, can I deploy the OpenVpn instance in the marketplace using terraform?


2 Replies

Hey Jake!

This earlier Community Questions post has an example of how you can go about deploying Marketplace Apps as StackScripts.

For example, if you want to find the Open VPN StackScript ID, you can use the following API call:

curl -k -H 'X-Filter: {"label": {"+contains": "OpenVPN"}}' -H "Content-Type: application/json" | jq '.data | .[] | .label,.id'

The result will be the following:

"OpenVPN Access Server (Login Data in Weblish/SSH)"
"Debian 7.5 OpenVPN"
"Docker (OpenVPN)"
"OpenVPN Install"
"Linode openVPN Server"
"Pritunl - Enterprise Distributed OpenVPN Server"
"OpenVPN One-Click"

Any Market Place apps are labeled "One-Click". You can then use our API Documentation to deploy a Linode using the StackScript ID.

I hope this helps!

The stack script id is also visible as part of the URL behind the "Deploy This App" button/link in the Marketplace, it's the value of the appID parameter. (e.g. 607026 for MySQL)

Use the API to get the list of user defined fields required for that stack script:

curl -H "Authorization: Bearer $LINODE_TOKEN" | jq

To use that with Terraform, use the stackscript_id and stackscript_data attributes of the linode_instance resource. Example:

resource "linode_instance" "db" {
  label           = var.label
  image           = var.image
  region          = var.region
  type            = var.instance_type
  root_pass       = random_password.root_pw.result
  authorized_keys = [chomp(var.ssh_public_key)]
  tags            = var.tags

  stackscript_id = 607026
  stackscript_data = {
    database        = "MariaDB"
    dbroot_password = random_password.dbroot_pw.result
    dbuser          = var.db_user
    dbuser_password = random_password.db_password.result
    database_name   = var.db_name


Please enter an answer

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct