Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
ba43d77
fix: role_arn support in AWSCloudWatch and AWSEmf exporters
yaten2302 Sep 7, 2025
ccec415
add changelog entry & tidy go.mod
yaten2302 Sep 7, 2025
a5326fb
Merge branch 'main' into fix/support-for-role_arn-in-cloud-watch
yaten2302 Sep 14, 2025
cf61353
update changelog entry
yaten2302 Sep 14, 2025
5d2d530
update testify pkg version
yaten2302 Sep 14, 2025
48756ff
Merge branch 'main' into fix/support-for-role_arn-in-cloud-watch
yaten2302 Sep 14, 2025
52b0d22
refactor GetAWSConfig + update changelog entry
yaten2302 Sep 14, 2025
0e4283c
tidy go.mod files
yaten2302 Sep 14, 2025
b0898db
Merge branch 'main' into fix/support-for-role_arn-in-cloud-watch
yaten2302 Sep 15, 2025
8178510
remove stsClient param from GetAWSConfig + update changelog entry
yaten2302 Sep 15, 2025
3c5e8c5
update awsxray component acc to GetAWSConfig
yaten2302 Sep 15, 2025
92474f5
update role_arn tests
yaten2302 Sep 15, 2025
8643009
tidy go.mod files
yaten2302 Sep 15, 2025
573ec70
attempt to fix linter errors
yaten2302 Sep 15, 2025
293aafe
Merge branch 'main' into fix/support-for-role_arn-in-cloud-watch
yaten2302 Sep 16, 2025
bffe43b
fix linter issues
yaten2302 Sep 16, 2025
b1b052c
Merge branch 'main' into fix/support-for-role_arn-in-cloud-watch
yaten2302 Sep 18, 2025
092df47
Merge branch 'main' into fix/support-for-role_arn-in-cloud-watch
atoulme Sep 22, 2025
889889b
Merge branch 'main' into fix/support-for-role_arn-in-cloud-watch
yaten2302 Sep 22, 2025
7e72009
refactor GetAWSConfig to add a helper func for better unit testing
yaten2302 Sep 22, 2025
b24605a
Merge branch 'main' into fix/support-for-role_arn-in-cloud-watch
yaten2302 Sep 22, 2025
591ff29
attempt to fix CI checks
yaten2302 Sep 22, 2025
4e8d800
Merge branch 'main' into fix/support-for-role_arn-in-cloud-watch
yaten2302 Sep 25, 2025
03e1554
Merge branch 'main' into fix/support-for-role_arn-in-cloud-watch
yaten2302 Sep 25, 2025
45acbce
Merge branch 'main' into fix/support-for-role_arn-in-cloud-watch
yaten2302 Sep 26, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .chloggen/fix_support-for-role_arn-in-cloud-watch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Use this changelog template to create an entry for release notes.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: "breaking"

# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
component: "awscloudwatchlogexporter"

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: "re-add support for `role_arn` in `awscloudwatchlogexporter` and `awsemfexporter`."

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
issues: [42115]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext:

# If your change doesn't affect end users or the exported elements of any package,
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
# Optional: The change log or logs in which this entry should be included.
# e.g. '[user]' or '[user, api]'
# Include 'user' if the change is relevant to end users.
# Include 'api' if there is a change to a library API.
# Default: '[user]'
change_logs: []
17 changes: 17 additions & 0 deletions internal/aws/awsutil/conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import (

"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/config"
"github.com/aws/aws-sdk-go-v2/credentials/stscreds"
"github.com/aws/aws-sdk-go-v2/service/sts"
"go.uber.org/zap"
"golang.org/x/net/http2"
)
Expand Down Expand Up @@ -103,6 +105,21 @@ func GetAWSConfig(ctx context.Context, logger *zap.Logger, settings *AWSSessionS
return aws.Config{}, err
}

if settings.RoleARN != "" {
stsClient := sts.NewFromConfig(cfg)

assumeRoleOpts := func(o *stscreds.AssumeRoleOptions) {
if settings.ExternalID != "" {
o.ExternalID = &settings.ExternalID
}
}

cfg.Credentials = aws.NewCredentialsCache(
stscreds.NewAssumeRoleProvider(stsClient, settings.RoleARN, assumeRoleOpts),
)
logger.Debug("Using AssumeRole", zap.String("role_arn", settings.RoleARN))
}

if cfg.Region == "" {
logger.Error("cannot fetch region variable from config file, environment variables and ec2 metadata")
return aws.Config{}, errors.New("cannot fetch region variable from config file, environment variables and ec2 metadata")
Expand Down
4 changes: 2 additions & 2 deletions internal/aws/awsutil/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ go 1.24.0
require (
github.com/aws/aws-sdk-go-v2 v1.37.0
github.com/aws/aws-sdk-go-v2/config v1.30.1
github.com/aws/aws-sdk-go-v2/credentials v1.18.1
github.com/aws/aws-sdk-go-v2/service/sts v1.35.0
github.com/stretchr/testify v1.10.0
go.uber.org/goleak v1.3.0
go.uber.org/zap v1.27.0
golang.org/x/net v0.43.0
)

require (
github.com/aws/aws-sdk-go-v2/credentials v1.18.1 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.0 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.0 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.0 // indirect
Expand All @@ -21,7 +22,6 @@ require (
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.0 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.26.0 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.31.0 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.35.0 // indirect
github.com/aws/smithy-go v1.22.5 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/kr/pretty v0.3.1 // indirect
Expand Down
Loading