Skip to content

SystemsManagerConfigurationSource overrides previously configured values #199

@JobaDiniz

Description

@JobaDiniz

Describe the bug

I got a weird behavior where previously set values on the configuration is set to empty/null after I call builder.Configuration.AddSystemsManager(ssmConfiguration.Prefix, TimeSpan.FromMinutes(30));.

After I call the above method, my previously set values are set to null: builder.Configuration["ConnectionStrings:temporal"] = "some value".

Regression Issue

  • Select this option if this issue appears to be a regression.

Expected Behavior

Calling builder.Configuration.AddSystemsManager(...); should not overwrite previously configured values.

Current Behavior

Calling builder.Configuration.AddSystemsManager(...); overwrites previously configured values.

Reproduction Steps

Code:

ConfigurationExtensions

public static IConfigurationBuilder MapDockerEnvironmentVariables(this IConfigurationManager builder)
{
    var temporalAddress = Environment.GetEnvironmentVariable("TEMPORAL_ADDRESS");
    if (!string.IsNullOrEmpty(temporalAddress))
        builder["ConnectionStrings:temporal"] = temporalAddress;

Program

var builder = Host.CreateApplicationBuilder(args);
builder.Configuration.MapDockerEnvironmentVariables();

 var ssmConfiguration = new AwsSsmConfiguration();
 builder.Configuration.GetSection("aws:ssm").Bind(ssmConfiguration);
 ssmConfiguration.EnsureValid();

 //NOTE: after the below line, the "ConnectionStrings:temporal" is set to null.
 builder.Configuration.AddSystemsManager(ssmConfiguration.Prefix, TimeSpan.FromMinutes(30));

Possible Solution

No response

Additional Information/Context

No response

AWS .NET SDK and/or Package version used

AWSSDK 3.7.400.70

Targeted .NET Platform

dotnet 8

Operating System and version

windows 11, amazonlinux

Metadata

Metadata

Assignees

Labels

bugThis issue is a bug.module/sys-mgr-extp2This is a standard priority issueresponse-requestedWaiting on additional info and feedback. Will move to "closing-soon" in 7 days.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions