-
Notifications
You must be signed in to change notification settings - Fork 9
Release test for AWS IAM Redis passwordless #189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 15 commits
1c05e19
3ffea3a
3bcad9f
61183c0
0040135
4bbb56e
6b5c497
8cd7f92
73e4c53
b8e6901
945c81a
bfe735f
e3d8379
0bc3c8e
42c91b4
51aad5a
5ba5078
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -3,23 +3,31 @@ | |||||||||
|
|
||||||||||
| locals { | ||||||||||
| redis = { | ||||||||||
| TFE_REDIS_HOST = var.redis_use_tls != null ? var.redis_use_tls ? "${var.redis_host}:6380" : var.redis_host : null | ||||||||||
| TFE_REDIS_USER = var.redis_user | ||||||||||
| TFE_REDIS_PASSWORD = var.redis_password | ||||||||||
| TFE_REDIS_USE_TLS = var.redis_use_tls | ||||||||||
| TFE_REDIS_USE_AUTH = var.redis_use_auth | ||||||||||
| TFE_REDIS_SENTINEL_ENABLED = var.redis_use_sentinel | ||||||||||
| TFE_REDIS_SENTINEL_HOSTS = join(",", var.redis_sentinel_hosts) | ||||||||||
| TFE_REDIS_SENTINEL_LEADER_NAME = var.redis_sentinel_leader_name | ||||||||||
| TFE_REDIS_SENTINEL_PASSWORD = var.redis_sentinel_password | ||||||||||
| TFE_REDIS_SENTINEL_USERNAME = var.redis_sentinel_user | ||||||||||
| TFE_REDIS_CA_CERT_PATH = var.redis_ca_cert_path | ||||||||||
| TFE_REDIS_CLIENT_CERT_PATH = var.redis_client_cert_path | ||||||||||
| TFE_REDIS_CLIENT_KEY_PATH = var.redis_client_key_path | ||||||||||
| TFE_REDIS_USE_MTLS = var.redis_use_mtls ? "true" : var.enable_sentinel_mtls ? "true" : "false" | ||||||||||
| TFE_REDIS_PASSWORDLESS_AZURE_USE_MSI = var.redis_passwordless_azure_use_msi | ||||||||||
| TFE_REDIS_SIDEKIQ_PASSWORDLESS_AZURE_USE_MSI = var.redis_passwordless_azure_use_msi | ||||||||||
| TFE_REDIS_PASSWORDLESS_AZURE_CLIENT_ID = var.redis_passwordless_azure_client_id | ||||||||||
| TFE_REDIS_HOST = var.redis_use_tls != null ? var.redis_use_tls ? "${var.redis_host}:6380" : var.redis_host : null | ||||||||||
| TFE_REDIS_USER = var.redis_passwordless_aws_use_instance_profile ? var.redis_passwordless_aws_iam_user : var.redis_user | ||||||||||
| TFE_REDIS_PASSWORD = var.redis_passwordless_aws_use_instance_profile ? null : var.redis_password | ||||||||||
| TFE_REDIS_USE_TLS = var.redis_use_tls | ||||||||||
| TFE_REDIS_USE_AUTH = var.redis_use_auth | ||||||||||
| TFE_REDIS_SENTINEL_ENABLED = var.redis_use_sentinel | ||||||||||
| TFE_REDIS_SENTINEL_HOSTS = join(",", var.redis_sentinel_hosts) | ||||||||||
| TFE_REDIS_SENTINEL_LEADER_NAME = var.redis_sentinel_leader_name | ||||||||||
| TFE_REDIS_SENTINEL_PASSWORD = var.redis_sentinel_password | ||||||||||
| TFE_REDIS_SENTINEL_USERNAME = var.redis_sentinel_user | ||||||||||
| TFE_REDIS_CA_CERT_PATH = var.redis_ca_cert_path | ||||||||||
| TFE_REDIS_CLIENT_CERT_PATH = var.redis_client_cert_path | ||||||||||
| TFE_REDIS_CLIENT_KEY_PATH = var.redis_client_key_path | ||||||||||
| TFE_REDIS_USE_MTLS = var.redis_use_mtls ? "true" : var.enable_sentinel_mtls ? "true" : "false" | ||||||||||
| TFE_REDIS_PASSWORDLESS_AZURE_USE_MSI = var.redis_passwordless_azure_use_msi | ||||||||||
| TFE_REDIS_SIDEKIQ_PASSWORDLESS_AZURE_USE_MSI = var.redis_passwordless_azure_use_msi | ||||||||||
| TFE_REDIS_PASSWORDLESS_AZURE_CLIENT_ID = var.redis_passwordless_azure_client_id | ||||||||||
| TFE_REDIS_PASSWORDLESS_AWS_USE_INSTANCE_PROFILE = var.redis_passwordless_aws_use_instance_profile | ||||||||||
| TFE_REDIS_SIDEKIQ_PASSWORDLESS_AWS_USE_INSTANCE_PROFILE = var.redis_passwordless_aws_use_instance_profile | ||||||||||
| TFE_REDIS_PASSWORDLESS_AWS_REGION = var.redis_passwordless_aws_region | ||||||||||
| TFE_REDIS_SIDEKIQ_PASSWORDLESS_AWS_REGION = var.redis_passwordless_aws_region | ||||||||||
| TFE_REDIS_PASSWORDLESS_AWS_HOST_NAME = var.redis_passwordless_aws_host_name | ||||||||||
| TFE_REDIS_SIDEKIQ_PASSWORDLESS_AWS_HOST_NAME = var.redis_passwordless_aws_host_name | ||||||||||
| TFE_REDIS_SIDEKIQ_USER = var.redis_passwordless_aws_use_instance_profile ? var.redis_passwordless_aws_iam_user : var.redis_user | ||||||||||
|
||||||||||
| TFE_REDIS_SIDEKIQ_USER = var.redis_passwordless_aws_use_instance_profile ? var.redis_passwordless_aws_iam_user : var.redis_user | |
| TFE_REDIS_SIDEKIQ_USER = var.redis_passwordless_aws_use_instance_profile ? var.redis_passwordless_aws_iam_user : var.redis_user | |
| # TFE_REDIS_SIDEKIQ_USE_TLS is set to var.redis_use_tls to ensure Sidekiq uses TLS if required. | |
| # This variable was added to fix missing Sidekiq TLS configuration; it is unrelated to AWS IAM authentication. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great catch! Why is this change included in the PR?
❓ How is it possible that our release tests for redis_use_tls ever passed ✅, if we never passed this configuration here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The TFE_REDIS_SIDEKIQ_USE_TLS variable was indeed missing from the configuration before.
While implementing Redis passwordless authentication, I noticed that Sidekiq-specific Redis configuration was incomplete. TFE has separate Redis connections for main application and Sidekiq background jobs - Sidekiq wasn't getting explicit TLS configuration. Sidekiq likely has application-level fallback logic that inherits TLS settings when not explicitly configured.
it was discovered during Redis IAM work and both changes touch Redis config, I included it here with proper documentation explaining it's unrelated to IAM auth.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -369,6 +369,30 @@ variable "redis_passwordless_azure_client_id" { | |
| description = "Azure Managed Service Identity (MSI) Client ID to be used for redis authentication. If not set, System Assigned Managed Identity will be used." | ||
| } | ||
|
|
||
| variable "redis_passwordless_aws_use_instance_profile" { | ||
| type = bool | ||
| description = "Boolean to use AWS instance profile for Redis IAM authentication." | ||
| default = false | ||
| } | ||
|
|
||
| variable "redis_passwordless_aws_region" { | ||
| type = string | ||
| description = "AWS Region of the AWS ElastiCache resource for Redis passwordless authentication." | ||
| default = null | ||
| } | ||
|
|
||
| variable "redis_passwordless_aws_host_name" { | ||
| type = string | ||
| description = "The name of the Redis instance on AWS for passwordless authentication." | ||
| default = null | ||
| } | ||
|
|
||
| variable "redis_passwordless_aws_iam_user" { | ||
| type = string | ||
| description = "The IAM username for Redis IAM authentication." | ||
| default = null | ||
| } | ||
|
Comment on lines
+378
to
+394
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ❓ Would it make sense to group these instead? That might be a better user experience, and communicate that they should be set together.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This would break existing module usage where these variables are already consumed. |
||
|
|
||
| variable "run_pipeline_image" { | ||
| type = string | ||
| description = "Container image used to execute Terraform runs. Leave blank to use the default image that comes with Terraform Enterprise. Defaults to \"\" if no value is given." | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The condition
var.redis_passwordless_aws_use_instance_profileis repeated multiple times throughout this file (lines 7, 8, 29). Consider extracting this into a local variable to improve maintainability and reduce duplication.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be nice to group all items affected by the var.redis_passwordless_aws_use_instance_profile by moving the lines closer to each other.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nikolasrieble Updated.