aws

package
v3.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 4, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package aws provides helper functions for creating AWS clients in apptest-framework tests.

This package simplifies AWS API access for tests that need to verify AWS resources (e.g., Load Balancers, EBS volumes, etc.) created by applications under test.

Authentication

When running in CI with IRSA (IAM Roles for Service Accounts) configured, the AWS SDK automatically discovers credentials from the projected service account token. No explicit credential configuration is required in test code.

Configuration

To enable IRSA authentication, add AWS configuration to your test suite's config.yaml:

appName: my-aws-app
repoName: my-aws-app
appCatalog: giantswarm
providers:
- capa
aws:
  iamRoleARN: "arn:aws:iam::123456789012:role/e2e-test-role"
  region: "eu-west-1"

Usage Example

import (
    "context"
    awshelper "github.com/giantswarm/apptest-framework/v3/pkg/aws"
    "github.com/aws/aws-sdk-go-v2/service/ec2"
)

It("should verify ELB was created", func() {
    ctx := context.Background()
    cfg, err := awshelper.NewConfig(ctx, "eu-west-1")
    Expect(err).NotTo(HaveOccurred())

    ec2Client := ec2.NewFromConfig(cfg)
    // Use ec2Client to verify resources...
})

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetIRSARoleARN

func GetIRSARoleARN() string

GetIRSARoleARN returns the IAM Role ARN configured via IRSA environment variables. Returns an empty string if IRSA is not configured.

func IsIRSAConfigured

func IsIRSAConfigured() bool

IsIRSAConfigured returns true if the IRSA environment variables are set, indicating that the pod is configured to use IAM Roles for Service Accounts.

func MustNewConfig

func MustNewConfig(ctx context.Context, region string) aws.Config

MustNewConfig creates an AWS config and panics if an error occurs. This is useful in test setup where failure should immediately stop the test.

func NewConfig

func NewConfig(ctx context.Context, region string) (aws.Config, error)

NewConfig creates an AWS config using the default credential chain.

When running with IRSA (IAM Roles for Service Accounts), credentials are automatically provided via the projected service account token. The AWS SDK uses the AWS_ROLE_ARN and AWS_WEB_IDENTITY_TOKEN_FILE environment variables that are set by the Kubernetes pod identity webhook.

The region parameter specifies the AWS region for API calls. If empty, the SDK will attempt to determine the region from environment variables or instance metadata.

func NewConfigWithRegion

func NewConfigWithRegion(ctx context.Context, region string) (aws.Config, error)

NewConfigWithRegion creates an AWS config with the specified region. This is a convenience wrapper around NewConfig that requires a region to be specified.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL