Skip to content

Commit dccc981

Browse files
committed
feat: add IoT provider support and related credentials definitions
This update introduces the IoT provider creation function and adds necessary environment variable definitions for IoT credentials in the AWS module. Additionally, the CMake configuration is updated to include the new IoT credentials source file. Signed-off-by: Eduardo Silva <[email protected]>
1 parent fb0b394 commit dccc981

File tree

4 files changed

+673
-0
lines changed

4 files changed

+673
-0
lines changed

include/fluent-bit/flb_aws_credentials.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,11 @@ struct flb_aws_provider *flb_eks_provider_create(struct flb_config *config,
225225
flb_aws_client_generator
226226
*generator);
227227

228+
/*
229+
* IoT Provider
230+
*/
231+
struct flb_aws_provider *flb_iot_provider_create(struct flb_config *config,
232+
struct flb_aws_client_generator *generator);
228233

229234
/*
230235
* STS Assume Role Provider.

src/aws/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ set(src
1515
"flb_aws_imds.c"
1616
"flb_aws_credentials_http.c"
1717
"flb_aws_credentials_profile.c"
18+
"flb_aws_credentials_iot.c"
1819
)
1920

2021
message(STATUS "=== AWS Credentials ===")

src/aws/flb_aws_credentials.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,14 @@
3838

3939
#define EKS_POD_EXECUTION_ROLE "EKS_POD_EXECUTION_ROLE"
4040

41+
/* IoT Credentials Environment Variables */
42+
#define AWS_IOT_KEY_FILE "AWS_IOT_KEY_FILE"
43+
#define AWS_IOT_CERT_FILE "AWS_IOT_CERT_FILE"
44+
#define AWS_IOT_CA_CERT_FILE "AWS_IOT_CA_CERT_FILE"
45+
#define AWS_IOT_CREDENTIALS_ENDPOINT "AWS_IOT_CREDENTIALS_ENDPOINT"
46+
#define AWS_IOT_THING_NAME "AWS_IOT_THING_NAME"
47+
#define AWS_IOT_ROLE_ALIAS "AWS_IOT_ROLE_ALIAS"
48+
4149
/* declarations */
4250
static struct flb_aws_provider *standard_chain_create(struct flb_config
4351
*config,
@@ -566,6 +574,14 @@ static struct flb_aws_provider *standard_chain_create(struct flb_config
566574

567575
mk_list_add(&sub_provider->_head, &implementation->sub_providers);
568576

577+
/* IoT Provider - check early since it requires specific environment variables */
578+
sub_provider = flb_iot_provider_create(config, generator);
579+
if (sub_provider) {
580+
/* IoT provider can fail if we are not running in IoT */
581+
mk_list_add(&sub_provider->_head, &implementation->sub_providers);
582+
flb_debug("[aws_credentials] Initialized IoT Provider in standard chain");
583+
}
584+
569585
flb_debug("[aws_credentials] creating profile %s provider", profile);
570586
sub_provider = flb_profile_provider_create(profile);
571587
if (sub_provider) {

0 commit comments

Comments
 (0)