sparse-intern-71089
03/24/2023, 4:23 AMstraight-fireman-55591
03/24/2023, 8:59 AMnice-pilot-2521
03/24/2023, 10:51 AMimport { Config } from "pulumi";
import { createSomeEcrResource } from "./ecr";
import { createSomeFargatResource } from "./fargate";
const ecrConfig = Config("ecr");
if (ecrConfig.getBoolean("enabled")) {
createSomeEcrResource(ecrConfig);
}
const fargateConfig = Config("fargate");
if (fargateConfig.getBoolean("enabled")) {
createSomeFargateResource(fargateConfig);
}
dry-journalist-60579
03/24/2023, 1:00 PMPulumi.*.yaml
correspond to separate Pulumi stacks of the same project?brief-car-60542
03/24/2023, 4:21 PMdry-journalist-60579
03/24/2023, 4:48 PMdry-journalist-60579
03/24/2023, 4:51 PMapplication
stack that has RDS, Amazon MQ, DNS, datadog, S3 buckets, SSM params, etc. and sets up the cluster… we have Pulumi.prod.yaml for the production site, Pulumi.staging.yaml for pre-prod, and Pulumi.dev.yaml for development…dry-journalist-60579
03/24/2023, 4:52 PMdry-journalist-60579
03/24/2023, 4:53 PMPulumi.ci.yaml
dry-journalist-60579
03/24/2023, 4:53 PMpulumi.export("ecr-url", repository.url)
(python)brief-car-60542
03/24/2023, 4:54 PMPulumi.staging.yaml
have S3 bucket.
and Pulumi.dev.yaml
dont have any S3 bucket.
The S3 bucket index.ts file will try to load both yaml and needs to decide this file doesnt have S3 bucket config, and I will skip doing nothing.dry-journalist-60579
03/24/2023, 4:54 PMbuild_stack = pulumi.StackReference("our-org/builds/ci")
BUILDS_ECR_URL = build_stack.get_output("ecr-url")
dry-journalist-60579
03/24/2023, 4:55 PMbrief-car-60542
03/24/2023, 4:56 PMdry-journalist-60579
03/24/2023, 4:57 PMif
statements are totally fine, and there are different approaches to the code designdry-journalist-60579
03/24/2023, 4:58 PMbrief-car-60542
03/24/2023, 4:58 PM├── infrastructure
│ ├── iac
│ │ ├── aws
│ │ │ ├── containers
│ │ │ │ ├── index.ts
│ │ │ │ ├── package.json
│ │ │ │ ├── Pulumi.yaml
│ │ │ │ ├── ecr
│ │ │ │ │ ├── index.ts
│ │ │ │ ├── fargate
│ │ │ │ │ ├── index.ts
│ │ │ ├── storage
│ │ │ │ ├── index.ts
│ │ │ │ ├── package.json
│ │ │ │ ├── Pulumi.yaml
│ │ │ │ ├── s3
│ │ │ │ │ ├── index.ts
Do you think I should do 1 project per resource or like what shown 1 project per categorybrief-car-60542
03/24/2023, 4:59 PMI was just checking to make sure that the different stacks within a single project weren't to set up different types of resources
If I have 1 project including many resource, I will have to do that right? with the structure I have above.dry-journalist-60579
03/24/2023, 5:26 PMcontainers
and storage
. To me, it doesn’t make sense for ecr
and fargate
to be separate “stacks” within the containers
projectdry-journalist-60579
03/24/2023, 5:27 PMdry-journalist-60579
03/24/2023, 5:28 PMecr
and fargate
are groups of resources that should live in the containers
project and when you want to launch those resources you should create a “stack” of the containers
projectdry-journalist-60579
03/24/2023, 5:29 PMcontainers/ecr/index.ts
and containers/fargate/index.ts
into the containers/index.ts
. For code organization, it’s nice to break it apart, and you can just use JS/TS importsbrief-car-60542
03/24/2023, 5:36 PMPulumi.dev.yaml
, this mean I want to have a dev cluster. and this cluster will have some resources such as ecr, fargate, s3.
And with my setup I will have 2 Pulumi.dev.yaml
file under storage
& containers
.
My questions will be should I keep ecr&fargate under same project of contaienrs or should I do this:
├── infrastructure
│ ├── iac
│ │ ├── aws
│ │ │ ├── containers
│ │ │ │ ├── ecr
│ │ │ │ │ ├── index.ts
│ │ │ │ │ ├── package.json
│ │ │ │ │ ├── Pulumi.yaml
│ │ │ │ │ ├── index.ts
│ │ │ │ ├── fargate
│ │ │ │ │ ├── index.ts
│ │ │ │ │ ├── package.json
│ │ │ │ │ ├── Pulumi.yaml
│ │ │ │ │ ├── index.ts
│ │ │ ├── storage
│ │ │ │ ├── s3
│ │ │ │ │ ├── index.ts
│ │ │ │ │ ├── package.json
│ │ │ │ │ ├── Pulumi.yaml
│ │ │ │ │ ├── index.ts
dry-journalist-60579
03/24/2023, 5:50 PMdry-journalist-60579
03/24/2023, 5:51 PMdry-journalist-60579
03/24/2023, 5:51 PMdry-journalist-60579
03/24/2023, 5:51 PMdry-journalist-60579
03/24/2023, 5:52 PMFor now, Zephyr has decided to go with a monorepo approach—a single repository that contains both their application code and the Pulumi code to manage the infrastructure resources. All of the resources are defined in a single Pulumi project, with multiple stacks that correspond to development and production environments. Over the course of this series, we'll see how Zephyr's use of Pulumi changes as Zephyr grows and their application evolves.
brief-car-60542
03/24/2023, 5:54 PMdry-journalist-60579
03/24/2023, 5:55 PMdry-journalist-60579
03/24/2023, 5:56 PMdry-journalist-60579
03/24/2023, 5:56 PMbrief-car-60542
03/24/2023, 5:56 PMbrief-car-60542
03/24/2023, 5:57 PMdry-journalist-60579
03/24/2023, 5:58 PMdry-journalist-60579
03/24/2023, 5:58 PMdry-journalist-60579
03/24/2023, 6:00 PMimport * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const bucket = new aws.s3.Bucket("bucket", {
acl: "private",
tags: {
Environment: "Dev",
Name: "My bucket",
},
});
… I think it’s ok to repeat declarative code like this sometimesdry-journalist-60579
03/24/2023, 6:00 PMs3/index.ts
?brief-car-60542
03/24/2023, 6:00 PMdry-journalist-60579
03/24/2023, 6:04 PMdry-journalist-60579
03/24/2023, 6:05 PMdry-journalist-60579
03/24/2023, 6:05 PMbrief-car-60542
03/24/2023, 6:07 PM