import * as aws from "@pulumi/aws"; import * as pulumi from "@pulumi/pulumi"; import { ExtraExposedServiceOptions } from "./exposePublicService"; import { NLBMapping } from "./exposeNlbService"; import { HealthCheck } from "@pulumi/aws/ecs"; import { Team } from "./fargateHelpers"; export declare const getDefaultLogs: (serviceName: string, logGroup: aws.cloudwatch.LogGroup) => aws.ecs.LogConfiguration; export declare function getClusterInstance(cluster: string | aws.ecs.Cluster | undefined): Promise | string>; export type ALBMapping = { domain: string; dockerListeningPort: number; healthCheck?: Partial; extraExposedServiceOptions?: ExtraExposedServiceOptions; }; export declare function getFargateExecutionRole(name: string, policyArnNamedMap: Record | aws.iam.Policy>, existingRole?: aws.iam.Role): { role: import("@pulumi/aws/iam/role").Role; policies: import("@pulumi/aws/iam/rolePolicyAttachment").RolePolicyAttachment[]; }; export declare function getFargateTaskRole(name: string, policyArnNamedMap: Record | aws.iam.Policy>, existingRole?: aws.iam.Role): { role: import("@pulumi/aws/iam/role").Role; policies: import("@pulumi/aws/iam/rolePolicyAttachment").RolePolicyAttachment[]; }; export type FargateTaskOptions = { securityGroups?: (string | pulumi.Output)[]; cluster?: aws.ecs.Cluster | string; healthCheck?: Partial; healthCheckContainer?: HealthCheck; ephemeralStorageInGB?: number; desiredCount?: number; memoryReservation?: number; cpuReservation?: number; /** * @deprecated use createInternalService() instead */ dontExpose?: true; version?: string; essential?: boolean; command?: string[]; extraExposedServiceOptions?: ExtraExposedServiceOptions; forceNewDeployment?: boolean; extraPortMappings?: aws.ecs.PortMapping[]; extraALBMappings?: ALBMapping[]; nlbMappings?: NLBMapping[]; executionRolePolicies?: Record | aws.iam.Policy>; taskRolePolicies?: Record | aws.iam.Policy>; /** * Optional pre-built IAM role to use as the Fargate task role. When provided, * the role is used as-is and `taskRolePolicies` are attached to it. When omitted * (default), a new role is created internally — current behavior, fully backward * compatible. Use this when callers need the task role ARN to exist before the * Fargate task (e.g., to scope a KMS key policy to that exact ARN). */ taskRole?: aws.iam.Role; /** * Optional pre-built IAM role to use as the Fargate execution role. When provided, * the role is used as-is and `executionRolePolicies` are attached to it. When * omitted (default), a new role is created internally — current behavior, fully * backward compatible. Symmetric to `taskRole`; same use case. */ executionRole?: aws.iam.Role; secrets?: aws.ecs.Secret[]; ignoreServiceDiscovery?: boolean; team: Team; metrics?: { port?: number | string; path: "/metrics"; jobName?: string; }; dontAssignPublicIp?: boolean; dependsOn?: pulumi.Resource[]; volumes?: aws.types.input.ecs.TaskDefinitionVolume[] | pulumi.Input; deregistrationDelay?: pulumi.Input; mountPoints?: aws.ecs.MountPoint[]; repositoryCredentials?: aws.ecs.RepositoryCredentials; runtimePlatform?: aws.types.input.ecs.TaskDefinitionRuntimePlatform; appAutoscaling?: { maxCapacity: number; minCapacity?: number; policy?: AppAutoscalingPolicy[]; scheduleAction?: { minCapacity: number; maxCapacity: number; /** * Must be in one of the following formats: * At expressions - "at(yyyy-mm-ddThh:mm:ss)" * Rate expressions - "rate(value unit)" * Cron expressions - "cron(fields)" * @type {string} */ schedule: string; }[]; }; enableExecuteCommand?: boolean; }; /** * One ECS Service Application-Auto-Scaling target-tracking policy. * * Tracks `metricName` (today only `ApproximateNumberOfMessagesVisible` is * understood as an SQS queue depth — anything else falls through with no * `customizedMetricSpecification` set) against `targetValue`. Required * cooldowns are enforced by AWS. * * Choose ONE of: * - `metricDimensionValue`: a single SQS queue URL. The policy tracks that * queue's depth directly. * - `metricDimensionValues`: 2+ SQS queue URLs. The policy uses CloudWatch * metric math to track the SUM of their depths under one signal — useful * when several queues feed the same worker pool and the desired pod count * must reflect total pending work, not the max of any one queue. (AWS's * default with N parallel target-tracking policies is max-of-all, which * undercounts when multiple queues have load simultaneously.) * * Setting both fields, or neither, throws at apply time. */ export type AppAutoscalingPolicy = { metricName: string; targetValue: number; /** Single-queue form. Mutually exclusive with `metricDimensionValues`. */ metricDimensionValue?: pulumi.Output; /** * Multi-queue (sum) form. Mutually exclusive with `metricDimensionValue`. * Must contain ≥1 entry; with a single entry, prefer `metricDimensionValue` * for clarity. */ metricDimensionValues?: pulumi.Output[]; statistic: "Average" | "Minimum" | "Maximum"; scaleOutCooldown: number; scaleInCooldown: number; }; /** * * @param serviceName A name for this service. For example, "builder-api" * @param dockerImage The docker image to run. "decentraland/builder-server" or "https://myregistry.com/org/imagename" * @param dockerListeningPort The port where the HTTP API is exposed. * @param environment Mapping of environment variables for the container * @param hostname Domain where to serve this API * @param options.securityGroups Additional Security Groups to add to the container. For example, the security group allowed to access a DB or an S3 bucket. * @param options.cluster The cluster where to run this. If none is provided, the `defaultCluster` will be used ({@see infra/defaultCluster.ts}) * @param options.healthCheckPath * @param options.policyArnNamedMap key-value named map of policies to attach to the default execution role for this task * @param options.appAutoscaling Configuration for autoscaling */ export declare function createFargateTask(serviceName: string, dockerImage: string | Promise | pulumi.OutputInstance, dockerListeningPort: number, environment: { name: string; value: pulumi.Input; secret?: boolean; }[], hostname: string, options: FargateTaskOptions): Promise<{ service: import("@pulumi/aws/ecs/service").Service; endpoint: string; exposed?: undefined; } | { endpoint: string; service: import("@pulumi/aws/ecs/service").Service; exposed: { domain: string; certificate: pulumi.Input; record: import("@pulumi/aws/route53/record").Record | undefined; targetGroup: import("@pulumi/aws/alb/targetGroup").TargetGroup; cloudflareRecord: import("@pulumi/cloudflare/record").Record | undefined; }; }>; export type InternalServiceOptions = { serviceName: string; cluster?: string | aws.ecs.Cluster; securityGroups?: (string | pulumi.Output)[]; ignoreServiceDiscovery?: boolean; serviceDiscoveryPort?: number; ephemeralStorageInGB?: number; desiredCount?: number; executionRole?: aws.iam.Role; taskRole?: aws.iam.Role; containerInfo: aws.ecs.ContainerDefinition; assignPublicIp?: boolean; forceNewDeployment?: boolean; dependsOn?: pulumi.Resource[]; volumes?: pulumi.Input; team: Team; targetGroups: aws.alb.TargetGroup[]; runtimePlatform?: aws.types.input.ecs.TaskDefinitionRuntimePlatform; appAutoscaling?: { maxCapacity: number; minCapacity?: number; policy?: AppAutoscalingPolicy[]; scheduleAction?: { maxCapacity: number; minCapacity: number; /** * Must be in one of the following formats: * At expressions - "at(yyyy-mm-ddThh:mm:ss)" * Rate expressions - "rate(value unit)" * Cron expressions - "cron(fields)" * @type {string} */ schedule: string; }[]; }; enableExecuteCommand?: boolean; }; export declare function createInternalService(config: InternalServiceOptions): Promise;