Skip to content

fix: Guard contains() against null in proxy_client_password_auth_type validation#96

Open
vyrwu wants to merge 1 commit into
cloudposse-terraform-components:mainfrom
vyrwu:fix/contains-null-validation-opentofu
Open

fix: Guard contains() against null in proxy_client_password_auth_type validation#96
vyrwu wants to merge 1 commit into
cloudposse-terraform-components:mainfrom
vyrwu:fix/contains-null-validation-opentofu

Conversation

@vyrwu

@vyrwu vyrwu commented Apr 23, 2026

Copy link
Copy Markdown

What

Replace || with a ternary in the proxy_client_password_auth_type variable validation to prevent contains() from receiving a null argument.

Why

On OpenTofu <1.10 (confirmed on v1.9.1), the || operator does not short-circuit evaluation. When proxy_client_password_auth_type is null (the default), both sides of the || are evaluated, and contains() receives null as its second argument, causing:

Error: Invalid function argument

  on variables.tf line 549, in variable "proxy_client_password_auth_type":
    │ while calling contains(list, value)
    │ var.proxy_client_password_auth_type is null

Invalid value for "value" parameter: argument must not be null.

This means any user on OpenTofu <1.10 who has not set proxy_client_password_auth_type will hit a plan failure with the current default of null.

Fix

- condition = var.proxy_client_password_auth_type == null || contains([...], var.proxy_client_password_auth_type)
+ condition = var.proxy_client_password_auth_type == null ? true : contains([...], var.proxy_client_password_auth_type)

The ternary guarantees contains() is never called when the value is null.

Generated with Claude Opus 4.6

On OpenTofu <1.10, the || operator does not short-circuit when the
left operand is true, causing contains() to receive a null argument
and fail with "argument must not be null". Replace with a ternary
to ensure contains() is never called when the variable is null.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Apr 23, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@vyrwu has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 44 minutes and 28 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 44 minutes and 28 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e3c157b2-62ac-4209-9d1b-9991194bfc50

📥 Commits

Reviewing files that changed from the base of the PR and between 4cdb023 and 7c318d0.

📒 Files selected for processing (1)
  • src/variables.tf
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@mergify mergify Bot requested review from a team April 23, 2026 11:21
@mergify mergify Bot added the triage Needs triage label Apr 23, 2026
@mergify

mergify Bot commented Jul 1, 2026

Copy link
Copy Markdown

💥 This pull request now has conflicts. Could you fix it @vyrwu? 🙏

@mergify mergify Bot added the conflict This PR has conflicts label Jul 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

conflict This PR has conflicts triage Needs triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant