@@ -826,7 +826,7 @@ pub async fn execute(log_level: &str, spec_file_path: &str, skip_prompt: bool) -
826
826
build_param( "AadTag" , & spec. aad_tag) ,
827
827
build_param( "S3Region" , & spec. resource. regions[ 0 ] ) ,
828
828
build_param( "S3BucketName" , & spec. resource. s3_bucket) ,
829
- build_param( "Ec2KeyPairName " , & regional_resource . ec2_key_name ) ,
829
+ build_param( "SshEnabled " , & spec . enable_ssh . to_string ( ) ) ,
830
830
build_param(
831
831
"InstanceProfileArn" ,
832
832
& regional_resource
@@ -878,6 +878,12 @@ pub async fn execute(log_level: &str, spec_file_path: &str, skip_prompt: bool) -
878
878
. unwrap ( ) ,
879
879
) ) ;
880
880
}
881
+ if spec. enable_ssh {
882
+ common_asg_params. push ( build_param (
883
+ "Ec2KeyPairName" ,
884
+ & regional_resource. ec2_key_name ,
885
+ ) ) ;
886
+ }
881
887
882
888
// just copy the regional machine params, and later overwrite if 'create-dev-machine' is true
883
889
let mut common_dev_machine_params = BTreeMap :: new ( ) ;
@@ -897,10 +903,13 @@ pub async fn execute(log_level: &str, spec_file_path: &str, skip_prompt: bool) -
897
903
common_dev_machine_params. insert ( "AadTag" . to_string ( ) , spec. aad_tag . clone ( ) ) ;
898
904
common_dev_machine_params
899
905
. insert ( "S3BucketName" . to_string ( ) , spec. resource . s3_bucket . clone ( ) ) ;
900
- common_dev_machine_params. insert (
901
- "Ec2KeyPairName" . to_string ( ) ,
902
- regional_resource. ec2_key_name . clone ( ) ,
903
- ) ;
906
+
907
+ if spec. enable_ssh {
908
+ common_dev_machine_params. insert (
909
+ "Ec2KeyPairName" . to_string ( ) ,
910
+ regional_resource. ec2_key_name . clone ( ) ,
911
+ ) ;
912
+ }
904
913
common_dev_machine_params. insert (
905
914
"InstanceProfileArn" . to_string ( ) ,
906
915
regional_resource
@@ -1346,8 +1355,10 @@ pub async fn execute(log_level: &str, spec_file_path: &str, skip_prompt: bool) -
1346
1355
}
1347
1356
}
1348
1357
1349
- let f = File :: open ( & regional_resource. ec2_key_path ) . unwrap ( ) ;
1350
- f. set_permissions ( PermissionsExt :: from_mode ( 0o444 ) ) . unwrap ( ) ;
1358
+ if spec. enable_ssh {
1359
+ let f = File :: open ( & regional_resource. ec2_key_path ) . unwrap ( ) ;
1360
+ f. set_permissions ( PermissionsExt :: from_mode ( 0o444 ) ) . unwrap ( ) ;
1361
+ }
1351
1362
1352
1363
println ! ( ) ;
1353
1364
let mut ssh_commands = Vec :: new ( ) ;
@@ -1379,7 +1390,7 @@ pub async fn execute(log_level: &str, spec_file_path: &str, skip_prompt: bool) -
1379
1390
} ,
1380
1391
} ;
1381
1392
if spec. enable_ssh {
1382
- println ! ( "\n {}\n " , ssh_command. to_string ( ) ) ;
1393
+ println ! ( "\n {}\n " , ssh_command) ;
1383
1394
} else {
1384
1395
println ! ( "\n {}\n " , ssh_command. ssm_start_session_command( ) ) ;
1385
1396
}
@@ -1855,8 +1866,10 @@ pub async fn execute(log_level: &str, spec_file_path: &str, skip_prompt: bool) -
1855
1866
}
1856
1867
}
1857
1868
1858
- let f = File :: open ( & regional_resource. ec2_key_path ) . unwrap ( ) ;
1859
- f. set_permissions ( PermissionsExt :: from_mode ( 0o444 ) ) . unwrap ( ) ;
1869
+ if spec. enable_ssh {
1870
+ let f = File :: open ( & regional_resource. ec2_key_path ) . unwrap ( ) ;
1871
+ f. set_permissions ( PermissionsExt :: from_mode ( 0o444 ) ) . unwrap ( ) ;
1872
+ }
1860
1873
1861
1874
println ! ( ) ;
1862
1875
let mut ssh_commands = Vec :: new ( ) ;
@@ -1889,7 +1902,7 @@ pub async fn execute(log_level: &str, spec_file_path: &str, skip_prompt: bool) -
1889
1902
} ,
1890
1903
} ;
1891
1904
if spec. enable_ssh {
1892
- println ! ( "\n {}\n " , ssh_command. to_string ( ) ) ;
1905
+ println ! ( "\n {}\n " , ssh_command) ;
1893
1906
} else {
1894
1907
println ! ( "\n {}\n " , ssh_command. ssm_start_session_command( ) ) ;
1895
1908
}
@@ -2740,6 +2753,9 @@ default-spec --log-level=info --funded-keys={funded_keys} --region={region} --up
2740
2753
regional_common_dev_machine_asg_params
2741
2754
. insert ( "SshKeyEmail" . to_string ( ) , email. clone ( ) ) ;
2742
2755
} ;
2756
+ // SSH keys for dev machine
2757
+ regional_common_dev_machine_asg_params
2758
+ . insert ( "SshEnabled" . to_string ( ) , spec. enable_ssh . to_string ( ) ) ;
2743
2759
2744
2760
if !dev_machine. instance_types . is_empty ( ) {
2745
2761
let instance_types = dev_machine. instance_types . clone ( ) ;
0 commit comments