dcl-ops-lib
v9.13.0
Published
Used to compile pulumi projects
Readme
dcl-ops-lib
Used to compile pulumi projects
Sidecars, environment variables and SSM parameters
createFargateTask accepts ssmParameters for the primary container, and each
entry of additionalContainers accepts environmentVariables and
ssmParameters, both as { ENV_VAR_NAME: value } maps:
environmentVariablesvalues are written as plain environment variables.ssmParametersvalues are SSM parameters exposed as secrets: a name (with or without a leading/), a full parameter ARN, or apulumi.Outputsuch as the.nameof anaws.ssm.Parametercreated in the same stack. A plain string name is looked up at preview (a typo fails early); an Output is not looked up, so a parameter created in the same stack works on its first deploy.
They are appended to the container's environment / secrets arrays, which
keep working as before. A variable name may be defined only once per container.
The execution role is granted read access to every secret of every container
(secrets and ssmParameters, primary and sidecars) through one inline policy:
ssm:GetParameters on SSM parameters and secretsmanager:GetSecretValue on
Secrets Manager secrets. No policy is created when there are no secrets.
- Customer-managed KMS keys are not covered: a value encrypted with one also
needs
kms:Decrypton that key, granted throughexecutionRolePolicies. - Names are turned into ARNs for the account and region of the default AWS
provider (
ssmParameterArn(name)does the same). For a parameter elsewhere, pass its full ARN. - Only
createFargateTasksupports the maps.createInternalServicerejects them, since it can't grant the execution role access to the secrets.
import * as aws from "@pulumi/aws"
import { createFargateTask } from "dcl-ops-lib/createFargateTask"
// Created by the stack; its value is set out of band (console / CLI), so
// Pulumi never overwrites it.
const collectorToken = new aws.ssm.Parameter(
"collector-token",
{ name: "/my-service/collector-token", type: "SecureString", value: "set-me" },
{ ignoreChanges: ["value"] }
)
await createFargateTask(
"my-service",
image,
5000,
[{ name: "LOG_LEVEL", value: "info" }],
"my-service.decentraland.zone",
{
team: "platform",
ssmParameters: { DATABASE_URL: "/my-service/database-url" },
taskCpuReservation: 512,
taskMemoryReservation: 1024,
additionalContainers: [
{
name: "otel-collector",
image: "otel/opentelemetry-collector-contrib:latest",
cpu: 256,
memory: 512,
essential: false,
environmentVariables: { CLICKHOUSE_HOST: "clickhouse.internal" },
ssmParameters: {
CLICKHOUSE_PASSWORD: "/my-service/clickhouse-password",
COLLECTOR_TOKEN: collectorToken.name,
},
},
],
}
)Releases
Published to npm as dcl-ops-lib by GitHub Actions (.github/workflows/release.yml)
via semantic-release, using npm OIDC trusted publishing:
- push to
master→ stable release on thelatestdist-tag - push to
next→ prerelease on thenextdist-tag
License
Published under Apache-2.0
