Skip to content
This repository has been archived by the owner on Oct 21, 2024. It is now read-only.

Commit

Permalink
Cluster: service inherit provider settings
Browse files Browse the repository at this point in the history
  • Loading branch information
fwang committed Oct 14, 2024
1 parent 8de9fe6 commit c3aa599
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions platform/src/components/aws/cluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1131,14 +1131,15 @@ export interface ClusterServiceArgs {
* ```
*/
export class Cluster extends Component {
private args: ClusterArgs;
private constructorArgs: ClusterArgs;
private constructorOpts: ComponentResourceOptions;
private cluster: ecs.Cluster;
public static v1 = ClusterV1;

constructor(
name: string,
args: ClusterArgs,
opts?: ComponentResourceOptions,
opts: ComponentResourceOptions = {},
) {
const _version = 2;
super(__pulumiType, name, args, opts, {
Expand All @@ -1163,7 +1164,8 @@ export class Cluster extends Component {

const cluster = createCluster();

this.args = args;
this.constructorArgs = args;
this.constructorOpts = opts;
this.cluster = cluster;

function createCluster() {
Expand Down Expand Up @@ -1243,14 +1245,18 @@ export class Cluster extends Component {
*/
public addService(name: string, args?: ClusterServiceArgs) {
// Do not prefix the service to allow `Resource.MyService` to work.
return new Service(name, {
cluster: {
name: this.cluster.name,
arn: this.cluster.arn,
return new Service(
name,
{
cluster: {
name: this.cluster.name,
arn: this.cluster.arn,
},
vpc: this.constructorArgs.vpc,
...args,
},
vpc: this.args.vpc,
...args,
});
{ provider: this.constructorOpts.provider },
);
}
}

Expand Down

0 comments on commit c3aa599

Please sign in to comment.