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

Component

Description

Type

resource

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

Required: Yes

string

app

The name of the application

Required: Yes

string

deploy

Application deployment object encompassing needed items to deploy the application.

Required: Yes

component

Deploy

Component path: resource > deploy

Component

Description

type

description

Description of the application

Required: No

string

image

The URL of the image that Shipa should use for deployment.

Required: Yes

string

private_image

Defines 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

port

Port 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_user

The 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_secret

The 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

team

The team that will be owner of the application.

Required: Yes

string

framework

Which framework should be used for deployment when creating the application.

Required: Yes

string

steps

When 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_weight

The amount of traffic that should be shifted to the new application version as steps are rolled out.

Required: No

number

step_interval

The 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

env

Key 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

Component

Description

Type

resource

The resource used by the Shipa provider and Terraform when managing CNAME, shipa_app_cname

string

app

The name of the existing application where the new CNAME should be added to.

Required: Yes

string

cname

The CNAME that should be assigned to the existing application.

Required: Yes

string

encrypt

Defines 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

Component

Description

Type

shipa_apps

Returns all existing apps which the logged in user has access to

string

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

Component

Description

Type

shipa_app

shipa_app is Shipa's component for returning data for a specific application when using Terraform.

string

id

The name of the application which you want to get the details from.

string


Did this page help you?