@@ -87,19 +87,17 @@ pub async fn execute(log_level: &str, spec_file_path: &str, skip_prompt: bool) -
87
87
let current_identity = sts_manager. get_identity ( ) . await . unwrap ( ) ;
88
88
89
89
// validate identity
90
- if let Some ( identity ) = & spec. resource . identity {
90
+ if ! spec. resource . identity . user_id . is_empty ( ) {
91
91
// AWS calls must be made from the same caller
92
- if !identity. eq ( & current_identity) {
93
- return Err ( Error :: new (
94
- ErrorKind :: Other ,
95
- format ! (
96
- "config identity {:?} != currently loaded identity {:?}" ,
97
- identity, current_identity
98
- ) ,
99
- ) ) ;
92
+ if spec. resource . identity . user_id != current_identity. user_id {
93
+ log:: warn!(
94
+ "config identity {:?} != currently loaded identity {:?}" ,
95
+ spec. resource. identity,
96
+ current_identity
97
+ ) ;
100
98
}
101
99
} else {
102
- spec. resource . identity = Some ( current_identity) ;
100
+ spec. resource . identity = current_identity;
103
101
}
104
102
105
103
// set defaults based on ID
@@ -639,6 +637,7 @@ pub async fn execute(log_level: &str, spec_file_path: &str, skip_prompt: bool) -
639
637
let vpc_stack_name = regional_resource. cloudformation_vpc . clone ( ) . unwrap ( ) ;
640
638
let vpc_params = Vec :: from ( [
641
639
build_param ( "Id" , & spec. id ) ,
640
+ build_param ( "UserId" , & spec. resource . identity . user_id ) ,
642
641
build_param ( "VpcCidr" , "10.0.0.0/16" ) ,
643
642
build_param ( "PublicSubnetCidr1" , "10.0.64.0/19" ) ,
644
643
build_param ( "PublicSubnetCidr2" , "10.0.128.0/19" ) ,
@@ -767,6 +766,7 @@ pub async fn execute(log_level: &str, spec_file_path: &str, skip_prompt: bool) -
767
766
768
767
let mut common_asg_params = vec ! [
769
768
build_param( "Id" , & spec. id) ,
769
+ build_param( "UserId" , & spec. resource. identity. user_id) ,
770
770
build_param(
771
771
"NetworkId" ,
772
772
format!( "{}" , & spec. avalanchego_config. network_id) . as_str( ) ,
@@ -834,6 +834,8 @@ pub async fn execute(log_level: &str, spec_file_path: &str, skip_prompt: bool) -
834
834
// just copy the regional machine params, and later overwrite if 'create-dev-machine' is true
835
835
let mut common_dev_machine_params = BTreeMap :: new ( ) ;
836
836
common_dev_machine_params. insert ( "Id" . to_string ( ) , format ! ( "{}-dev-machine" , spec. id) ) ;
837
+ common_dev_machine_params
838
+ . insert ( "UserId" . to_string ( ) , spec. resource . identity . user_id . clone ( ) ) ;
837
839
common_dev_machine_params. insert ( "AsgName" . to_string ( ) , format ! ( "{}-dev-machine" , spec. id) ) ;
838
840
common_dev_machine_params. insert (
839
841
"KmsKeyArn" . to_string ( ) ,
@@ -1039,10 +1041,13 @@ pub async fn execute(log_level: &str, spec_file_path: &str, skip_prompt: bool) -
1039
1041
None ,
1040
1042
OnFailure :: Delete ,
1041
1043
& cloudformation_asg_anchor_nodes_tmpl,
1042
- Some ( Vec :: from ( [ Tag :: builder ( )
1043
- . key ( "KIND" )
1044
- . value ( "avalanche-ops" )
1045
- . build ( ) ] ) ) ,
1044
+ Some ( Vec :: from ( [
1045
+ Tag :: builder ( ) . key ( "KIND" ) . value ( "avalanche-ops" ) . build ( ) ,
1046
+ Tag :: builder ( )
1047
+ . key ( "UserId" )
1048
+ . value ( spec. resource . identity . user_id . clone ( ) )
1049
+ . build ( ) ,
1050
+ ] ) ) ,
1046
1051
Some ( anchor_asg_params) ,
1047
1052
)
1048
1053
. await
@@ -1515,10 +1520,13 @@ pub async fn execute(log_level: &str, spec_file_path: &str, skip_prompt: bool) -
1515
1520
None ,
1516
1521
OnFailure :: Delete ,
1517
1522
& cloudformation_asg_non_anchor_nodes_tmpl,
1518
- Some ( Vec :: from ( [ Tag :: builder ( )
1519
- . key ( "KIND" )
1520
- . value ( "avalanche-ops" )
1521
- . build ( ) ] ) ) ,
1523
+ Some ( Vec :: from ( [
1524
+ Tag :: builder ( ) . key ( "KIND" ) . value ( "avalanche-ops" ) . build ( ) ,
1525
+ Tag :: builder ( )
1526
+ . key ( "UserId" )
1527
+ . value ( spec. resource . identity . user_id . clone ( ) )
1528
+ . build ( ) ,
1529
+ ] ) ) ,
1522
1530
Some ( non_anchor_asg_params) ,
1523
1531
)
1524
1532
. await
@@ -2194,10 +2202,13 @@ cat /tmp/{node_id}.crt
2194
2202
Some ( vec ! [ Capability :: CapabilityNamedIam ] ) ,
2195
2203
OnFailure :: Delete ,
2196
2204
& ssm_doc_tmpl,
2197
- Some ( Vec :: from ( [ Tag :: builder ( )
2198
- . key ( "KIND" )
2199
- . value ( "avalanche-ops" )
2200
- . build ( ) ] ) ) ,
2205
+ Some ( Vec :: from ( [
2206
+ Tag :: builder ( ) . key ( "KIND" ) . value ( "avalanche-ops" ) . build ( ) ,
2207
+ Tag :: builder ( )
2208
+ . key ( "UserId" )
2209
+ . value ( spec. resource . identity . user_id . clone ( ) )
2210
+ . build ( ) ,
2211
+ ] ) ) ,
2201
2212
Some ( cfn_params) ,
2202
2213
)
2203
2214
. await
@@ -2665,10 +2676,13 @@ default-spec --log-level=info --funded-keys={funded_keys} --region={region} --up
2665
2676
None ,
2666
2677
OnFailure :: Delete ,
2667
2678
& asg_tmpl,
2668
- Some ( Vec :: from ( [ Tag :: builder ( )
2669
- . key ( "KIND" )
2670
- . value ( "avalanche-ops" )
2671
- . build ( ) ] ) ) ,
2679
+ Some ( Vec :: from ( [
2680
+ Tag :: builder ( ) . key ( "KIND" ) . value ( "avalanche-ops" ) . build ( ) ,
2681
+ Tag :: builder ( )
2682
+ . key ( "UserId" )
2683
+ . value ( spec. resource . identity . user_id . clone ( ) )
2684
+ . build ( ) ,
2685
+ ] ) ) ,
2672
2686
Some ( cfn_params) ,
2673
2687
)
2674
2688
. await
0 commit comments