From bf31a459407ca5bf78bf5205602e358b8dd592a3 Mon Sep 17 00:00:00 2001 From: Wesley Pettit Date: Mon, 17 Jan 2022 21:44:15 -0800 Subject: [PATCH] out_s3: add support for external_id Signed-off-by: Wesley Pettit --- plugins/out_s3/s3.c | 14 ++++++++------ plugins/out_s3/s3.h | 1 + 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/plugins/out_s3/s3.c b/plugins/out_s3/s3.c index c9910175113..c2edffc1aa8 100644 --- a/plugins/out_s3/s3.c +++ b/plugins/out_s3/s3.c @@ -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; @@ -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, @@ -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, @@ -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), diff --git a/plugins/out_s3/s3.h b/plugins/out_s3/s3.h index e2d3548da46..dcf694586d8 100644 --- a/plugins/out_s3/s3.h +++ b/plugins/out_s3/s3.h @@ -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;