Application Management

The Shipa provider for Terraform allows you to manage your application lifecycle directly from Terraform.

The example below shows the different options that can be leveraged when managing applications on Shipa through Terraform:

Creating and Deploying Applications

📘

Shipa Application and Deployment Object Merge - Shipa 1.7.1

Shipa has merged the Application and Deployment Terraform Objects in Shipa 1.7.1+. If using a prior version, check out the previous version's documentation. Shipa still supports the old Terraform Objects, though is deprecated.

terraform {
  required_providers {
    shipa = {
      version = "0.0.13"
      source = "shipa-corp/shipa"
    }
  }
}

provider "shipa" {
  host = "http://target.shipa.cloud:80"
  token = "<your-shipa-token>"
}

resource "shipa_app_deploy" "tfapp" {
  app = "terraform-app"
  deploy {
    description     = "test description update"
    image           = "docker.io/shipasoftware/bulletinboard:1.0"
    private_image   = true
    port            = 2121
    registry_user   = local.dockerhub_username
    registry_secret = local.dockerhub_password
    team            = "dev"
    framework       = "dev-framework"
    steps           = 2
    step_weight    = 10
    step_interval  = 1m
    tags            = ["dev", "sandbox", "updated"]
    env = [
      "VARIABLE_ONE=v1",
      "VARIABLE_TWO=v2",
    ]
  }
}

Top-Level Attributes

ComponentDescriptionType
resourceThe resource type and name leveraged by Shipa when creating your application.

Required: Yes
string
appThe name of the application

Required: Yes
string
deployApplication deployment object encompassing needed items to deploy the application.

Required: Yes
component

Deploy

Component path: resource > deploy

ComponentDescriptiontype
descriptionDescription of the application

Required: No
string
imageThe URL of the image that Shipa should use for deployment.


Required: Yes
string
private_imageDefines if the image used for deployment will be pulled from a private registry.

Required: No

If not specified, Shipa will default to pulling from a public image registry.
boolean
portPort allows you to specify a specific port where your application should be exposed.

Required: No

If not specified, Shipa will automatically assign port 8888 to your application.
number
registry_userThe username that should be used by Shipa in order to authenticate and pull the image from the registry defined.

Required: No

Condition: Should only be used when private_image is set to true
string
registry_secretThe password that should be used by Shipa in order to authenticate and pull the image from the registry defined.

Required: No

Condition: Should only be used when private_image is set to true
string
teamThe team that will be owner of the application.

Required: Yes
string
frameworkWhich framework should be used for deployment when creating the application.

Required: Yes
string
stepsWhen using Canary for the application deployment, this component specifies the number of steps that should be used by Shipa when rolling out the deployment.

Required: No

If not specified, Shipa will perform a deployment of the image and direct 100% of the traffic to it once deployment is complete.
number
step_weightThe amount of traffic that should be shifted to the new application version as steps are rolled out.

Required: No
number
step_intervalThe interval that should be used between steps when shifting traffic to the new application image.
Supported min: m, hour:h, second:s. ex. 1m, 60s, 1h.

Required: No
string
envKey value pair of environmental variables. Shipa will automatically mask all of the environmental variables. Changes to the environmental variables will restart the application.

"VARIABLE_ONE=v1",
"VARIABLE_TWO=v2",


Required: No
list of strings

Managing CNAME

terraform {
  required_providers {
    shipa = {
      version = "0.0.13"
      source = "shipa-corp/shipa"
    }
  }
}

provider "shipa" {}

resource "shipa_app_cname" "cname1" {
  app = "terraform-app-2"
  cname = "test.com"
  encrypt = true
}

Component Attributes

ComponentDescriptionType
resourceThe resource used by the Shipa provider and Terraform when managing CNAME, shipa_app_cnamestring
appThe name of the existing application where the new CNAME should be added to.

Required: Yes
string
cnameThe CNAME that should be assigned to the existing application.

Required: Yes
string
encryptDefines if the new CNAME should be HTTP or HTTPS.

If encrypted, an HTTPS endpoint will be added to the application and a certificate will be automatically generated using Let's Encrypt.

Required: No

If not defined, an HTTP endpoint will be automatically generated.
string

Listing Applications

terraform {
  required_providers {
    shipa = {
      version = "0.0.13"
      source = "shipa-corp/shipa"
    }
  }
}

provider "shipa" {}

# Returns all apps
data "shipa_apps" "all" {}

output "all_apps" {
  value = data.shipa_apps.all.apps
}

Component Attributes

ComponentDescriptionType
shipa_appsReturns all existing apps which the logged in user has access tostring

Listing an Application Info

terraform {
  required_providers {
    shipa = {
      version = "0.0.13"
      source = "shipa-corp/shipa"
    }
  }
}

provider "shipa" {}

data "shipa_app" "app" {
  id = "terraform-app"
}

output "app" {
  value = data.shipa_app.app
}

Component Attributes

ComponentDescriptionType
shipa_appshipa_app is Shipa's component for returning data for a specific application when using Terraform.string
idThe name of the application which you want to get the details from.string