Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for custom providers passed in ComponentResourceOptions #176

Closed

Conversation

igorshapiro
Copy link

No description provided.

@igorshapiro igorshapiro force-pushed the support_custom_providers branch 2 times, most recently from d40cd57 to 46dc7c4 Compare March 9, 2019 23:47
Copy link
Member

@lukehoban lukehoban left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The provider should be inherited from the parent component - which is the canonical approach we’ve encouraged for Component design.

That should cause everything (or nearly everything) in this PR to not be necessary - as you already get the same result without the need to manually pass this information down from the component options to child options.

What issue did you run into which caused you to create this PR?

@igorshapiro
Copy link
Author

@lukehoban That's what I thought, but then I've seen that all the resources are created using the default provider (even though an explicit provider was passed).
Maybe I missed something, but try passing the component a custom provider...

@igorshapiro igorshapiro force-pushed the support_custom_providers branch 5 times, most recently from 7910073 to 731a505 Compare April 13, 2019 17:33
@@ -31,7 +31,7 @@ export class NatGateway
constructor(name: string, vpc: x.ec2.Vpc, args: NatGatewayArgs | ExistingNatGatewayArgs, opts: pulumi.ComponentResourceOptions = {}) {
super("awsx:x:ec2:NatGateway", name, {}, { parent: vpc, ...opts });

const parentOpts = { parent: this };
const parentOpts = { parent: vpc };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this doesn't seem right. we'd want the child resources to see this NatGateway as their parent. is there a reason this needed ot happen?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@@ -71,12 +71,12 @@ export class Vpc extends pulumi.ComponentResource {
enableDnsHostnames: utils.ifUndefined(args.enableDnsHostnames, true),
enableDnsSupport: utils.ifUndefined(args.enableDnsSupport, true),
instanceTenancy: utils.ifUndefined(args.instanceTenancy, "default"),
});
}, { parent: this });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is good.

this.id = this.vpc.id;

// Create the appropriate subnets. Default to a single public and private subnet for each
// availability zone if none were specified.
const topology = new VpcTopology(this, name, cidrBlock, numberOfAvailabilityZones, opts);
const topology = new VpcTopology(this, name, cidrBlock, numberOfAvailabilityZones, { parent: this, ...opts });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...opts should be necessary. we should just need to pass along us as the parent.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. Only opts left

@igorshapiro igorshapiro force-pushed the support_custom_providers branch 2 times, most recently from db7b588 to a73beb0 Compare April 13, 2019 21:38
@CyrusNajmabadi
Copy link
Contributor

Closing out as the primary parts of this PR have been merged in. Thanks for the contribution @igorshapiro !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants