Skip to content

Commit

Permalink
out_s3: add support for external_id
Browse files Browse the repository at this point in the history
Signed-off-by: Wesley Pettit <[email protected]>
  • Loading branch information
PettitWesley authored and edsiper committed Jan 21, 2022
1 parent 4f45109 commit bf31a45
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
14 changes: 8 additions & 6 deletions plugins/out_s3/s3.c
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,6 @@ static int cb_s3_init(struct flb_output_instance *ins,
int async_flags;
int len;
char *role_arn = NULL;
char *external_id = NULL;
char *session_name;
const char *tmp;
struct flb_s3 *ctx = NULL;
Expand Down Expand Up @@ -795,10 +794,6 @@ static int cb_s3_init(struct flb_output_instance *ins,
/* Use the STS Provider */
ctx->base_provider = ctx->provider;
role_arn = (char *) tmp;
tmp = flb_output_get_property("external_id", ins);
if (tmp) {
external_id = (char *) tmp;
}

/* STS provider needs yet another separate TLS instance */
ctx->sts_provider_tls = flb_tls_create(FLB_TRUE,
Expand Down Expand Up @@ -826,7 +821,7 @@ static int cb_s3_init(struct flb_output_instance *ins,
ctx->provider = flb_sts_provider_create(config,
ctx->sts_provider_tls,
ctx->base_provider,
external_id,
ctx->external_id,
role_arn,
session_name,
ctx->region,
Expand Down Expand Up @@ -2391,6 +2386,13 @@ static struct flb_config_map config_map[] = {
"that key will be sent to S3."
},

{
FLB_CONFIG_MAP_STR, "external_id", NULL,
0, FLB_TRUE, offsetof(struct flb_s3, external_id),
"Specify an external ID for the STS API, can be used with the role_arn parameter if your role "
"requires an external ID."
},

{
FLB_CONFIG_MAP_BOOL, "static_file_path", "false",
0, FLB_TRUE, offsetof(struct flb_s3, static_file_path),
Expand Down
1 change: 1 addition & 0 deletions plugins/out_s3/s3.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ struct flb_s3 {
char *canned_acl;
char *content_type;
char *log_key;
char *external_id;
int free_endpoint;
int retry_requests;
int use_put_object;
Expand Down

0 comments on commit bf31a45

Please sign in to comment.