-
Notifications
You must be signed in to change notification settings - Fork 3
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
Add SSM-based feature flags #873
base: main
Are you sure you want to change the base?
Conversation
@@ -0,0 +1,4 @@ | |||
output "ssm_parameter_arns" { |
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.
Not blocking, but given this is tied to SSM/returns ARNs, I wonder if we should name the module like ssm_feature_flags
or feature_flags__ssm
(assuming we eventually develop a "feature_flag" interface of which this is one implementation) or something?
import logging | ||
import os | ||
import boto3 | ||
logger = logging.getLogger() | ||
def is_feature_enabled(feature_name: str) -> bool: | ||
value = os.environ.get(f"FF_{feature_name}") | ||
return value == "true" if value else False | ||
|
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.
import logging | |
import os | |
import boto3 | |
logger = logging.getLogger() | |
def is_feature_enabled(feature_name: str) -> bool: | |
value = os.environ.get(f"FF_{feature_name}") | |
return value == "true" if value else False | |
import os | |
def is_feature_enabled(feature_name: str) -> bool: | |
value = os.environ.get(f"FF_{feature_name}") | |
return value == "true" if value else False |
FOO = false | ||
BAR = false |
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.
Should this be empty (or commented out) in the template?
Doesn't really hurt anything, but potentially confusing/worth a callout in docs that you'll see a FF_FOO
/FF_BAR
env var in your runtime environment unless you delete these.
Similar for the override in infra/{{app_name}}/app-config/dev.tf
# checkov:skip=CKV2_AWS_34:Feature flags values don't need to be encrypted | ||
for_each = var.feature_flags | ||
|
||
name = "/service/${var.service_name}/${each.key}" |
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 have the FF stuff partitioned out, something like:
name = "/service/${var.service_name}/${each.key}" | |
name = "/service/${var.service_name}/feature-flag/${each.key}" |
If folks name their flags enable_
(or similar) then /service/my-service-dev/enable-new-flow
isn't too bad, but /service/my-service-dev/bar
would be more confusing than service/my-service-dev/feature-flag/bar
.
Ticket
Resolves #{TICKET NUMBER OR URL}
Changes
Context for reviewers
Re-adding feature flag support using SSM params and environment variables
Testing
see navapbc/platform-test#178