sparse-intern-71089
07/09/2019, 5:52 PMgentle-diamond-70147
07/09/2019, 5:55 PMgentle-diamond-70147
07/09/2019, 5:55 PMwhite-balloon-205
// Create a 1st class provider so we can expicitly connect to an assumeRole account. Also log the account number so we
// know we are targetting the right one!
const awsProvider = new aws.Provider("testing", {
region: region,
assumeRole: {
roleArn: assumeRoleArn,
},
});
aws.getCallerIdentity({ provider: awsProvider }).then(identity => {
<http://pulumi.log.info|pulumi.log.info>(`Account: ${identity.accountId}`, awsProvider);
});
The key part is really the last three lines of code. The rest is just to use an explicit provider to be more clear on how I want to configure my AWS connection.
The result is you'll get a log entry in preview
and update
with the account being used for the deployment.bitter-island-28909
07/09/2019, 5:59 PMorange-tailor-85423
07/10/2019, 4:18 PMwhite-balloon-205
new aws.Provider
.
For (2), yes, you need to then pass that provider to all resources. The easiest way to do this is to put your resources inside components, have all child resources mark themselves as parent: this
within the component, and then pass the provider itself just at the places you construct the component. Children of a component (and grandchildren, etc.) will inherit the provider.