@@ -8,6 +8,7 @@ import * as path from 'path'
8
8
import * as vscode from 'vscode'
9
9
import * as nls from 'vscode-nls'
10
10
11
+ import { asEnvironmentVariables } from '../../credentials/credentialsUtilities'
11
12
import { AwsContext , NoActiveCredentialError } from '../../shared/awsContext'
12
13
import { makeTemporaryToolkitFolder } from '../../shared/filesystemUtilities'
13
14
import { RegionProvider } from '../../shared/regions/regionProvider'
@@ -26,7 +27,7 @@ const localize = nls.loadMessageBundle()
26
27
interface DeploySamApplicationParameters {
27
28
sourceTemplatePath : string
28
29
deployRootFolder : string
29
- profile : string
30
+ environmentVariables : NodeJS . ProcessEnv
30
31
region : string
31
32
packageBucketName : string
32
33
destinationStackName : string
@@ -61,13 +62,13 @@ export async function deploySamApplication(
61
62
awsContext,
62
63
window = getDefaultWindowFunctions ( )
63
64
} : {
64
- awsContext : Pick < AwsContext , 'getCredentialProfileName ' >
65
+ awsContext : Pick < AwsContext , 'getCredentials ' >
65
66
window ?: WindowFunctions
66
67
}
67
68
) : Promise < void > {
68
69
try {
69
- const profile : string | undefined = awsContext . getCredentialProfileName ( )
70
- if ( ! profile ) {
70
+ const credentials = await awsContext . getCredentials ( )
71
+ if ( ! credentials ) {
71
72
throw new NoActiveCredentialError ( )
72
73
}
73
74
@@ -84,7 +85,7 @@ export async function deploySamApplication(
84
85
destinationStackName : deployWizardResponse . stackName ,
85
86
packageBucketName : deployWizardResponse . s3Bucket ,
86
87
parameterOverrides : deployWizardResponse . parameterOverrides ,
87
- profile ,
88
+ environmentVariables : asEnvironmentVariables ( credentials ) ,
88
89
region : deployWizardResponse . region ,
89
90
sourceTemplatePath : deployWizardResponse . template . fsPath
90
91
}
@@ -156,9 +157,8 @@ async function packageOperation(params: {
156
157
} ) : Promise < void > {
157
158
params . channelLogger . info (
158
159
'AWS.samcli.deploy.workflow.packaging' ,
159
- 'Packaging SAM Application to S3 Bucket: {0} with profile: {1}' ,
160
- params . deployParameters . packageBucketName ,
161
- params . deployParameters . profile
160
+ 'Packaging SAM Application to S3 Bucket: {0}' ,
161
+ params . deployParameters . packageBucketName
162
162
)
163
163
164
164
const buildTemplatePath = getBuildTemplatePath ( params . deployParameters . deployRootFolder )
@@ -168,7 +168,7 @@ async function packageOperation(params: {
168
168
{
169
169
sourceTemplateFile : buildTemplatePath ,
170
170
destinationTemplateFile : packageTemplatePath ,
171
- profile : params . deployParameters . profile ,
171
+ environmentVariables : params . deployParameters . environmentVariables ,
172
172
region : params . deployParameters . region ,
173
173
s3Bucket : params . deployParameters . packageBucketName
174
174
} ,
@@ -185,17 +185,16 @@ async function deployOperation(params: {
185
185
try {
186
186
params . channelLogger . info (
187
187
'AWS.samcli.deploy.workflow.stackName.initiated' ,
188
- 'Deploying SAM Application to CloudFormation Stack: {0} with profile: {1}' ,
189
- params . deployParameters . destinationStackName ,
190
- params . deployParameters . profile
188
+ 'Deploying SAM Application to CloudFormation Stack: {0}' ,
189
+ params . deployParameters . destinationStackName
191
190
)
192
191
193
192
const packageTemplatePath = getPackageTemplatePath ( params . deployParameters . deployRootFolder )
194
193
195
194
await runSamCliDeploy (
196
195
{
197
196
parameterOverrides : params . deployParameters . parameterOverrides ,
198
- profile : params . deployParameters . profile ,
197
+ environmentVariables : params . deployParameters . environmentVariables ,
199
198
templateFile : packageTemplatePath ,
200
199
region : params . deployParameters . region ,
201
200
stackName : params . deployParameters . destinationStackName
@@ -232,9 +231,8 @@ async function deploy(params: {
232
231
233
232
params . channelLogger . info (
234
233
'AWS.samcli.deploy.workflow.success' ,
235
- 'Successfully deployed SAM Application to CloudFormation Stack: {0} with profile: {1}' ,
236
- params . deployParameters . destinationStackName ,
237
- params . deployParameters . profile
234
+ 'Successfully deployed SAM Application to CloudFormation Stack: {0}' ,
235
+ params . deployParameters . destinationStackName
238
236
)
239
237
240
238
params . window . showInformationMessage (
@@ -264,9 +262,6 @@ function enhanceAwsCloudFormationInstructions(
264
262
)
265
263
) {
266
264
message += ` --region ${ deployParameters . region } `
267
- if ( deployParameters . profile ) {
268
- message += ` --profile ${ deployParameters . profile } `
269
- }
270
265
}
271
266
272
267
return message
0 commit comments