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 Applications
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" "app2" {
app {
name = "terraform-app"
teamowner = "dev"
framework = "dev-framework"
description = "test description update"
tags = ["dev", "sandbox", "updated"]
}
}
Top-Level Attributes
Component | Description | Type |
---|---|---|
resource | The resource type and name leveraged by Shipa when creating your application. This will enable Terraform to drive the app configuration | string |
App
Component path: resource > app
Component | Description | type |
---|---|---|
name | The name of the application Required: Yes | string |
teamowner | 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 |
description | Application description Required: No | string |
tags | Application related tags Required: No | string |
Managing Environment Variables
terraform {
required_providers {
shipa = {
version = "0.0.13"
source = "shipa-corp/shipa"
}
}
}
provider "shipa" {}
resource "shipa_app_env" "env1" {
app = "terraform-app"
app_env {
envs {
name = "SHIPA_ENV1"
value = "test-1"
}
envs {
name = "SHIPA_ENV2"
value = "test-2"
}
norestart = true
private = false
}
}
Top-Level Attributes
Component | Description | Type |
---|---|---|
resource | The resource used by the Shipa provider and Terraform when creating environment variables, shipa_app_env | string |
app | The name of the existing application where the environment variable should be created | string |
The environment variable name and value that should be created | string |
Application Environment Variables
Component path: resource > app_env
Component | Description | Type |
---|---|---|
envs | The list of environment variables and values that should be created by the Shipa provider for a specific application. Required: Yes | |
name | The name of the environment variable that should be assigned to an existing application. Required: Yes | string |
value | The value of the environment variable that should be assigned to an existing application. Required: Yes | string |
norestart | If the application should be restarted when the environment variable is created. Required: No If not defined, Shipa will not restart the application when the environment variable is set. | bool |
private | If the environment variable should be encrypted or not. Required: No If not defined, Shipa will not encrypt the environment variable value by default. | bool |
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 |
Deploying Applications
terraform {
required_providers {
shipa = {
version = "0.0.13"
source = "shipa-corp/shipa"
}
}
}
provider "shipa" {}
resource "shipa_app_deploy" "deploy1" {
app = "terraform-app"
deploy {
image = "docker.io/shipasoftware/bulletinboard:1.0"
private_image = true
registry_user = "[email protected]"
registry_secret = "user-registry-password"
steps = 2
step_weight = 10
step_interval = 1m
port = 8000
}
}
Top-Level Attributes
Component | Description | Type |
---|---|---|
resource | The resource used by the Shipa provider and Terraform when deploying the application, shipa_app_deploy | string |
app | The name of the existing application where the image should be deployed to. | string |
Deployment definitions | string |
Deployment Definitions
Component path: resource > deploy
Component | Description | Type |
---|---|---|
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 | bool |
registry_user | The username that should be used by Shipa in order to authenticate and pull the image from the registry defined. Required: No | 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 | 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. Required: No | string |
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 |
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 |
Updated 6 days ago