Added an additional check for the trusted profile payload #111
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
The provided Terraform expression conditionally constructs a data_payload_chain_map based on the value of local.is_dockerjsonconfig_chain. If it's true, an auths map is generated by iterating over var.es_container_registry_secrets_chain. For each registry secret, the corresponding es_container_registry is used as the key, and its value is determined based on the presence of es_container_registry_email and trusted_profile. If es_container_registry_email is defined and non-empty, the credentials include username, password, and email. If not, but a trusted_profile is specified, then the credentials fall back to using trusted_profile as the username with the templated password. Otherwise, a default username of iamapikey is used. However, this logic has a flaw: the trusted_profile block will be applied even when the secret type is iam_credentials, which may lead to incorrect or unintended authentication configuration. The expression lacks an explicit check to distinguish between secret types, potentially resulting in misconfigured payloads when trusted_profile is present but not applicable.
Due to this I have added the following line to avoid the mishap
Release required?
x.x.X)x.X.x)X.x.x)Release notes content
Run the pipeline
If the CI pipeline doesn't run when you create the PR, the PR requires a user with GitHub collaborators access to run the pipeline.
Run the CI pipeline when the PR is ready for review and you expect tests to pass. Add a comment to the PR with the following text:
Checklist for reviewers
For mergers