UNPKG

@studion/infra-code-blocks

Version:
143 lines (142 loc) 4.57 kB
import * as pulumi from '@pulumi/pulumi'; import * as aws from '@pulumi/aws'; import { Size } from '../types/size'; export declare const awsRegion: string; export declare const assumeRolePolicy: aws.iam.PolicyDocument; export type RoleInlinePolicy = { /** * Name of the role policy. */ name?: pulumi.Input<string>; /** * Policy document as a JSON formatted string. */ policy?: pulumi.Input<string>; }; export type PersistentStorageMountPoint = { sourceVolume: string; containerPath: string; readOnly?: boolean; }; export type PersistentStorageVolume = { name: string; }; export type PersistentStorageConfig = { volumes: PersistentStorageVolume[]; mountPoints: PersistentStorageMountPoint[]; }; export type EcsServiceArgs = { /** * The ECR image used to start a container. */ image: pulumi.Input<string>; /** * Exposed service port. */ port: pulumi.Input<number>; /** * The aws.ecs.Cluster id. */ clusterId: pulumi.Input<string>; /** * The aws.ecs.Cluster name. */ clusterName: pulumi.Input<string>; vpcId: pulumi.Input<string>; /** * The IPv4 CIDR block for the VPC. */ vpcCidrBlock: pulumi.Input<string>; /** * If the `assignPublicIp` parameter is set to `true`, the publicSubnetIds * must be provided; otherwise, provide the privateSubnetIds. */ subnetIds: pulumi.Input<pulumi.Input<string>[]>; /** * Number of instances of the task definition to place and keep running. Defaults to 1. */ desiredCount?: pulumi.Input<number>; /** * CPU and memory size used for running the container. Defaults to "small". * Available predefined options are: * - small (0.25 vCPU, 0.5 GB memory) * - medium (0.5 vCPU, 1 GB memory) * - large (1 vCPU memory, 2 GB memory) * - xlarge (2 vCPU, 4 GB memory) */ size?: pulumi.Input<Size>; /** * The environment variables to pass to a container. Don't use this field for * sensitive information such as passwords, API keys, etc. For that purpose, * please use the `secrets` property. * Defaults to []. */ environment?: pulumi.Input<aws.ecs.KeyValuePair[]>; /** * The secrets to pass to the container. Defaults to []. */ secrets?: pulumi.Input<aws.ecs.Secret[]>; /** * Enable service auto discovery and assign DNS record to service. * Defaults to false. */ enableServiceAutoDiscovery: pulumi.Input<boolean>; /** * Configuration for multiple EFS volumes and their mount points. * Each mount point specifies a container path where the EFS volume will be mounted. */ persistentStorageConfig?: pulumi.Input<PersistentStorageConfig>; /** * Alternate docker CMD instruction. */ dockerCommand?: pulumi.Input<string[]>; /** * Autoscaling options for ecs service. */ autoscaling?: pulumi.Input<{ /** * Is autoscaling enabled or disabled. Defaults to false. */ enabled: pulumi.Input<boolean>; /** * Min capacity of the scalable target. Defaults to 1. */ minCount?: pulumi.Input<number>; /** * Max capacity of the scalable target. Defaults to 1. */ maxCount?: pulumi.Input<number>; }>; lbTargetGroupArn?: aws.lb.TargetGroup['arn']; /** * Custom service security group * In case no security group is provided, default security group will be used. */ securityGroup?: aws.ec2.SecurityGroup; /** * Assign public IP address to service. */ assignPublicIp?: pulumi.Input<boolean>; taskExecutionRoleInlinePolicies?: pulumi.Input<pulumi.Input<RoleInlinePolicy>[]>; taskRoleInlinePolicies?: pulumi.Input<pulumi.Input<RoleInlinePolicy>[]>; /** * A map of tags to assign to the resource. */ tags?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; }; export declare class EcsService extends pulumi.ComponentResource { name: string; logGroup: aws.cloudwatch.LogGroup; taskDefinition: aws.ecs.TaskDefinition; serviceDiscoveryService?: aws.servicediscovery.Service; service: aws.ecs.Service; constructor(name: string, args: EcsServiceArgs, opts?: pulumi.ComponentResourceOptions); private createLogGroup; private createPersistentStorage; private createTaskDefinition; private createServiceDiscovery; private createEcsService; private enableAutoscaling; }