You can use this submodule to provision IBM Code Engine App .
provider "ibm" {
ibmcloud_api_key = " XXXXXXXXXX" # pragma: allowlist secret
region = " us-south"
}
module "app" {
source = " terraform-ibm-modules/code-engine/ibm//modules/app"
version = " latest" # Replace "latest" with a release version to lock into a specific release
project_id = " project_id"
name = " app_name"
image_reference = " icr.io/codeengine/helloworld"
run_env_variables = [{
type = " literal"
name = " env_name"
value = " env_value"
}]
}
Required IAM access policies
You need the following permissions to run this module.
IAM Services
Code Engine service
Editor
platform access
Writer
service access
No modules.
Name
Description
Type
Default
Required
image_port
The port which is used to connect to the port that is exposed by the container image.
number
8080
no
image_reference
The name of the image that is used for the app.
string
n/a
yes
image_secret
The name of the image registry access secret.
string
null
no
managed_domain_mappings
Define which of the following values for the system-managed domain mappings to set up for the application: local_public
, local_private
, and local
. See https://cloud.ibm.com/docs/codeengine?topic=codeengine-application-workloads#optionsvisibility
string
null
no
name
The name of the app.
string
n/a
yes
project_id
The ID of the project where app will be created.
string
n/a
yes
run_arguments
Arguments for the app that are passed to start the container.
list(string)
[]
no
run_as_user
The user ID (UID) to run the app.
number
null
no
run_commands
Commands for the app that are passed to start the container.
list(string)
[]
no
run_env_variables
References to config maps, secrets or a literal values that are exposed as environment variables within the running application.
list(object({ type = optional(string) name = optional(string) value = optional(string) prefix = optional(string) key = optional(string) reference = optional(string) }))
[]
no
run_service_account
The name of the service account.
string
"default"
no
run_volume_mounts
Optional mounts of config maps or a secrets.
list(object({ mount_path = string reference = string name = optional(string) type = string }))
[]
no
scale_concurrency
The maximum number of requests that can be processed concurrently per instance.
number
100
no
scale_concurrency_target
The threshold of concurrent requests per instance at which one or more additional instances are created.
number
null
no
scale_cpu_limit
The number of CPU set for the instance of the app.
string
"1"
no
scale_ephemeral_storage_limit
The amount of ephemeral storage to set for the instance of the app.
string
"400M"
no
scale_initial_instances
The initial number of instances that are created upon app creation or app update.
number
1
no
scale_max_instances
The maximum number of instances for this app.
number
10
no
scale_memory_limit
The amount of memory set for the instance of the app.
string
"4G"
no
scale_min_instances
The minimum number of instances for this app. If you set this value to 0, the app will scale down to zero, if not hit by any request for some time.
number
0
no
scale_request_timeout
The amount of time in seconds that is allowed for a running app to respond to a request.
number
300
no
Name
Description
app_id
The ID of the created code engine app.
endpoint
URL to application. Depending on visibility this is accessible publicly or in the private network only.
endpoint_internal
URL to application that is only visible within the project.
id
The unique identifier of the created code engine app.
name
The name of the created code engine app.