@@ -483,7 +483,7 @@ func NewAWSSessionWithKeyV2(accessKey *iamtypes.AccessKey) *awsv2.Config {
483
483
}
484
484
485
485
// createCloudFormationStack ensures the cloudformation stack is up to date.
486
- func createCloudFormationStack (ctx context.Context , cfg awsv2.Config , prov client.ConfigProvider , t * cfn_bootstrap.Template , tags map [string ]string ) error {
486
+ func createCloudFormationStack (ctx context.Context , cfg * awsv2.Config , prov client.ConfigProvider , t * cfn_bootstrap.Template , tags map [string ]string ) error {
487
487
By (fmt .Sprintf ("Creating AWS CloudFormation stack for AWS IAM resources: stack-name=%s" , t .Spec .StackName ))
488
488
cfnClient := cfn .New (prov )
489
489
// CloudFormation stack will clean up on a failure, we don't need an Eventually here.
@@ -545,8 +545,8 @@ func SetMultitenancyEnvVars(prov client.ConfigProvider) error {
545
545
}
546
546
547
547
// Delete resources that already exists.
548
- func deleteResourcesInCloudFormation (ctx context.Context , cfg awsv2.Config , t * cfn_bootstrap.Template ) {
549
- iamSvc := iam .NewFromConfig (cfg )
548
+ func deleteResourcesInCloudFormation (ctx context.Context , cfg * awsv2.Config , t * cfn_bootstrap.Template ) {
549
+ iamSvc := iam .NewFromConfig (* cfg )
550
550
temp := * renderCustomCloudFormation (t )
551
551
var (
552
552
iamUsers []* cfn_iam.User
@@ -660,7 +660,7 @@ func deleteResourcesInCloudFormation(ctx context.Context, cfg awsv2.Config, t *c
660
660
}
661
661
662
662
// TODO: remove once test infra accounts are fixed.
663
- func deleteMultitenancyRoles (ctx context.Context , cfg awsv2.Config ) {
663
+ func deleteMultitenancyRoles (ctx context.Context , cfg * awsv2.Config ) {
664
664
if err := DeleteRole (ctx , cfg , "multi-tenancy-role" ); err != nil {
665
665
By (fmt .Sprintf ("failed to delete role multi-tenancy-role %s" , err ))
666
666
}
@@ -670,8 +670,8 @@ func deleteMultitenancyRoles(ctx context.Context, cfg awsv2.Config) {
670
670
}
671
671
672
672
// detachAllPoliciesForRole detaches all policies for role.
673
- func detachAllPoliciesForRole (ctx context.Context , cfg awsv2.Config , name string ) error {
674
- iamSvc := iam .NewFromConfig (cfg )
673
+ func detachAllPoliciesForRole (ctx context.Context , cfg * awsv2.Config , name string ) error {
674
+ iamSvc := iam .NewFromConfig (* cfg )
675
675
676
676
input := & iam.ListAttachedRolePoliciesInput {
677
677
RoleName : aws .String (name ),
@@ -697,8 +697,8 @@ func detachAllPoliciesForRole(ctx context.Context, cfg awsv2.Config, name string
697
697
}
698
698
699
699
// DeleteUser deletes an IAM user in a best effort manner.
700
- func DeleteUser (ctx context.Context , cfg awsv2.Config , name string ) error {
701
- iamSvc := iam .NewFromConfig (cfg )
700
+ func DeleteUser (ctx context.Context , cfg * awsv2.Config , name string ) error {
701
+ iamSvc := iam .NewFromConfig (* cfg )
702
702
703
703
// if user does not exist, return.
704
704
_ , err := iamSvc .GetUser (ctx , & iam.GetUserInput {UserName : aws .String (name )})
@@ -715,8 +715,8 @@ func DeleteUser(ctx context.Context, cfg awsv2.Config, name string) error {
715
715
}
716
716
717
717
// DeleteRole deletes roles in a best effort manner.
718
- func DeleteRole (ctx context.Context , cfg awsv2.Config , name string ) error {
719
- iamSvc := iam .NewFromConfig (cfg )
718
+ func DeleteRole (ctx context.Context , cfg * awsv2.Config , name string ) error {
719
+ iamSvc := iam .NewFromConfig (* cfg )
720
720
721
721
// if role does not exist, return.
722
722
_ , err := iamSvc .GetRole (ctx , & iam.GetRoleInput {RoleName : aws .String (name )})
@@ -868,8 +868,8 @@ func ensureTestImageUploaded(e2eCtx *E2EContext) error {
868
868
869
869
// ensureNoServiceLinkedRoles removes an auto-created IAM role, and tests
870
870
// the controller's IAM permissions to use ELB and Spot instances successfully.
871
- func ensureNoServiceLinkedRoles (ctx context.Context , cfg awsv2.Config ) {
872
- iamSvc := iam .NewFromConfig (cfg )
871
+ func ensureNoServiceLinkedRoles (ctx context.Context , cfg * awsv2.Config ) {
872
+ iamSvc := iam .NewFromConfig (* cfg )
873
873
874
874
By ("Deleting AWS IAM Service Linked Role: role-name=AWSServiceRoleForElasticLoadBalancing" )
875
875
_ , err := iamSvc .DeleteServiceLinkedRole (ctx , & iam.DeleteServiceLinkedRoleInput {
@@ -929,8 +929,8 @@ func encodeCredentials(accessKey *iamtypes.AccessKey, region string) string {
929
929
930
930
// newUserAccessKey generates a new AWS Access Key pair based off of the
931
931
// bootstrap user. This tests that the CloudFormation policy is correct.
932
- func newUserAccessKey (ctx context.Context , cfg awsv2.Config , userName string ) * iamtypes.AccessKey {
933
- iamSvc := iam .NewFromConfig (cfg )
932
+ func newUserAccessKey (ctx context.Context , cfg * awsv2.Config , userName string ) * iamtypes.AccessKey {
933
+ iamSvc := iam .NewFromConfig (* cfg )
934
934
935
935
keyOuts , _ := iamSvc .ListAccessKeys (ctx , & iam.ListAccessKeysInput {
936
936
UserName : aws .String (userName ),
0 commit comments