Skip to content

Commit ff773e2

Browse files
authored
internal/config: remove UseLegacyWorkflow option (#962)
This option was added to temporarily enable the legacy credential chain evaluation order from V1 of this library to be adopted within V2. As of Terraform 1.8, the ability to use this legacy behavior has been completely removed, and the credential chain is always evaluated in the same order as the AWS SDK. As this option is no longer in use by any consumers of this library, it can be safely removed here.
1 parent 08ee76b commit ff773e2

File tree

3 files changed

+3
-38
lines changed

3 files changed

+3
-38
lines changed

aws_config_test.go

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,32 +1031,6 @@ aws_secret_access_key = DefaultSharedCredentialsSecretKey
10311031
aws_access_key_id = DefaultSharedCredentialsAccessKey
10321032
aws_secret_access_key = DefaultSharedCredentialsSecretKey
10331033
1034-
[SharedCredentialsProfile]
1035-
aws_access_key_id = ProfileSharedCredentialsAccessKey
1036-
aws_secret_access_key = ProfileSharedCredentialsSecretKey
1037-
`,
1038-
},
1039-
{
1040-
Config: &Config{
1041-
Profile: "SharedCredentialsProfile",
1042-
Region: "us-east-1",
1043-
UseLegacyWorkflow: true,
1044-
},
1045-
Description: "environment AWS_ACCESS_KEY_ID overrides config Profile in legacy workflow",
1046-
EnvironmentVariables: map[string]string{
1047-
"AWS_ACCESS_KEY_ID": servicemocks.MockEnvAccessKey,
1048-
"AWS_SECRET_ACCESS_KEY": servicemocks.MockEnvSecretKey,
1049-
},
1050-
ExpectedCredentialsValue: mockdata.MockEnvCredentials,
1051-
ExpectedRegion: "us-east-1",
1052-
MockStsEndpoints: []*servicemocks.MockEndpoint{
1053-
servicemocks.MockStsGetCallerIdentityValidEndpoint,
1054-
},
1055-
SharedCredentialsFile: `
1056-
[default]
1057-
aws_access_key_id = DefaultSharedCredentialsAccessKey
1058-
aws_secret_access_key = DefaultSharedCredentialsSecretKey
1059-
10601034
[SharedCredentialsProfile]
10611035
aws_access_key_id = ProfileSharedCredentialsAccessKey
10621036
aws_secret_access_key = ProfileSharedCredentialsSecretKey

credentials.go

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,9 @@ func getCredentialsProvider(ctx context.Context, c *Config) (aws.CredentialsProv
4545
}
4646

4747
if c.Profile != "" && os.Getenv("AWS_ACCESS_KEY_ID") != "" && os.Getenv("AWS_SECRET_ACCESS_KEY") != "" {
48-
if c.UseLegacyWorkflow {
49-
diags.AddWarning("Configuration conflict overridden",
50-
`A Profile was specified along with the environment variables "AWS_ACCESS_KEY_ID" and "AWS_SECRET_ACCESS_KEY". `+
51-
`The legacy workflow is enabled, so the Profile will be ignored in favor of the environment variable credentials. `+
52-
`This behavior may be removed in the future.`)
53-
c.Profile = ""
54-
} else {
55-
diags.AddWarning("Configuration conflict detected",
56-
`A Profile was specified along with the environment variables "AWS_ACCESS_KEY_ID" and "AWS_SECRET_ACCESS_KEY". `+
57-
`The Profile is now used instead of the environment variable credentials. This may lead to unexpected behavior.`)
58-
}
48+
diags.AddWarning("Configuration conflict detected",
49+
`A Profile was specified along with the environment variables "AWS_ACCESS_KEY_ID" and "AWS_SECRET_ACCESS_KEY". `+
50+
`The Profile is now used instead of the environment variable credentials. This may lead to unexpected behavior.`)
5951
}
6052

6153
if profile := c.Profile; profile != "" {

internal/config/config.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ type Config struct {
6666
TokenBucketRateLimiterCapacity int
6767
UseDualStackEndpoint bool
6868
UseFIPSEndpoint bool
69-
UseLegacyWorkflow bool
7069
UserAgent UserAgentProducts
7170
}
7271

0 commit comments

Comments
 (0)