astonishing-dentist-11149
03/14/2023, 8:13 PMlittle-cartoon-10569
03/14/2023, 8:15 PMastonishing-dentist-11149
03/14/2023, 8:16 PMsecretValues.forEach((value: string, key: string) => {
const param = new aws.ssm.Parameter(`${env}-ssm-${value}`, {
name: value,
type: "SecureString",
value: config.requireSecret(key),
});
little-cartoon-10569
03/14/2023, 8:17 PMastonishing-dentist-11149
03/14/2023, 8:20 PMlittle-cartoon-10569
03/14/2023, 8:22 PMastonishing-dentist-11149
03/14/2023, 8:23 PMlittle-cartoon-10569
03/14/2023, 8:23 PMastonishing-dentist-11149
03/14/2023, 8:29 PMconst baseSecretArns = baseStackRef.getOutput('baseSecrets') as pulumi.Output<aws.ecs.Secret[]>;
const envSecretArns = envStackRef.getOutput(`envSecrets`) as pulumi.Output<aws.ecs.Secret[]>;
const secrets: pulumi.Output<aws.ecs.Secret[]> = pulumi
.all([baseSecretArns, envSecretArns])
.apply(([base, env]) => {
return base.concat(env);
});
little-cartoon-10569
03/14/2023, 8:31 PMastonishing-dentist-11149
03/14/2023, 8:32 PMlittle-cartoon-10569
03/14/2023, 8:33 PMastonishing-dentist-11149
03/14/2023, 8:35 PMlittle-cartoon-10569
03/14/2023, 8:35 PMastonishing-dentist-11149
03/14/2023, 8:40 PMlittle-cartoon-10569
03/14/2023, 8:48 PMastonishing-dentist-11149
03/14/2023, 8:49 PMlittle-cartoon-10569
03/14/2023, 8:49 PMastonishing-dentist-11149
03/14/2023, 8:50 PMconst canMsService = new awsx.ecs.FargateService(`${env}-${serviceName}`, {
cluster: cluster,
desiredCount: config.requireNumber('instanceCount'),
securityGroups: [sg],
assignPublicIp: false,
deploymentCircuitBreaker: {
enable: true,
rollback: true,
},
taskDefinitionArgs: {
container: {
image: canMsDockerImage,
cpu: 1024,
memory: 3072,
command: [],
portMappings: [canMsTargetGroup],
secrets: secrets,
environment: Object.entries(environment).map((entry: [string, string | pulumi.Output<string>]) => ({
name: entry[0],
value: entry[1],
})),
},
},
});
little-cartoon-10569
03/14/2023, 8:52 PMenvironment
property?astonishing-dentist-11149
03/14/2023, 8:52 PMlittle-cartoon-10569
03/14/2023, 8:52 PMastonishing-dentist-11149
03/14/2023, 8:52 PMlittle-cartoon-10569
03/14/2023, 8:53 PMastonishing-dentist-11149
03/14/2023, 8:54 PMlittle-cartoon-10569
03/14/2023, 8:54 PMastonishing-dentist-11149
03/14/2023, 8:55 PMlittle-cartoon-10569
03/14/2023, 8:56 PMastonishing-dentist-11149
03/14/2023, 8:56 PMlittle-cartoon-10569
03/14/2023, 8:57 PMastonishing-dentist-11149
03/14/2023, 8:57 PMlittle-cartoon-10569
03/14/2023, 8:57 PMastonishing-dentist-11149
03/14/2023, 8:58 PMlittle-cartoon-10569
03/14/2023, 9:00 PMastonishing-dentist-11149
03/14/2023, 9:00 PMlittle-cartoon-10569
03/14/2023, 9:00 PMastonishing-dentist-11149
03/14/2023, 9:01 PMenvSecrets
) as pulumi.Output<aws.ecs.Secret[]>;little-cartoon-10569
03/14/2023, 9:01 PMastonishing-dentist-11149
03/14/2023, 9:02 PMexport function createSecrets(config: pulumi.Config): aws.ecs.Secret[] {
let awsSecrets: aws.ecs.Secret[] = [];
little-cartoon-10569
03/14/2023, 9:03 PMastonishing-dentist-11149
03/14/2023, 9:03 PMsecretValues.forEach((value: string, key: string) => {
const param = new aws.ssm.Parameter(`base-ssm-${value}`, {
name: value,
type: "SecureString",
value: config.requireSecret(value),
});
awsSecrets.push({
name: key, //Key is the Variable name in AWS on ECS
valueFrom: param.arn,
});
});
little-cartoon-10569
03/14/2023, 9:04 PMastonishing-dentist-11149
03/14/2023, 9:05 PM"dependencies": {
"@pulumi/pulumi": "^3.0.0",
"@pulumi/aws": "^5.0.0",
"@pulumi/awsx": "^1.0.0"
},
little-cartoon-10569
03/14/2023, 9:06 PMastonishing-dentist-11149
03/14/2023, 9:07 PMlittle-cartoon-10569
03/14/2023, 9:07 PMastonishing-dentist-11149
03/14/2023, 9:09 PMlittle-cartoon-10569
03/14/2023, 9:11 PMastonishing-dentist-11149
03/14/2023, 9:11 PM/**
* The secrets to pass to the container. For more information, see
* [Specifying-Sensitive-Data](<https://docs.aws.amazon.com/AmazonECS/latest/developerguide/specifying-sensitive-data.html>)
* in the Amazon Elastic Container Service Developer Guide.
*/
secrets?: pulumi.Input<aws.ecs.Secret[]>;
little-cartoon-10569
03/14/2023, 9:11 PMastonishing-dentist-11149
03/14/2023, 9:14 PMlittle-cartoon-10569
03/14/2023, 9:18 PM