-
-
Notifications
You must be signed in to change notification settings - Fork 51
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
feature: Recording strategy #102
Conversation
recording_group { | ||
all_supported = true | ||
all_supported = var.enable_exclusion == true || var.enable_inclusion == true ? false : true |
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.
I think this could be simplified to
all_supported = var.enable_exclusion == true || var.enable_inclusion == true ? false : true | |
all_supported = !var.enable_exclusion && !var.enable_inclusion |
@@ -295,7 +310,7 @@ locals { | |||
enabled = module.this.enabled && !contains(var.disabled_aggregation_regions, data.aws_region.this.name) | |||
|
|||
is_central_account = var.central_resource_collector_account == data.aws_caller_identity.this.account_id | |||
is_global_recorder_region = var.global_resource_collector_region == data.aws_region.this.name | |||
is_global_recorder_region = var.global_resource_collector_region == data.aws_region.this.name && !(length(var.strategy_resource_types) > 0) |
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.
is_global_recorder_region = var.global_resource_collector_region == data.aws_region.this.name && !(length(var.strategy_resource_types) > 0) | |
is_global_recorder_region = var.global_resource_collector_region == data.aws_region.this.name && length(var.strategy_resource_types) == 0 |
} | ||
|
||
# Only if inclusion enabled | ||
resource_types = var.enable_inclusion == true && length(var.strategy_resource_types) > 0 ? var.strategy_resource_types : [] |
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.
Looks like this needs to be in recording_mode
block? based on this example
also can be simplified
resource_types = var.enable_inclusion == true && length(var.strategy_resource_types) > 0 ? var.strategy_resource_types : [] | |
resource_types = var.enable_inclusion && length(var.strategy_resource_types) > 0 ? var.strategy_resource_types : [] |
for_each = var.enable_exclusion ? [1] : [] | ||
content { | ||
resource_types = length(var.strategy_resource_types) > 0 ? var.strategy_resource_types : [] | ||
} | ||
} |
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.
for_each = var.enable_exclusion ? [1] : [] | |
content { | |
resource_types = length(var.strategy_resource_types) > 0 ? var.strategy_resource_types : [] | |
} | |
} | |
for_each = var.enable_exclusion && length(var.strategy_resource_types) > 0 ? [1] : [] | |
content { | |
resource_types = var.strategy_resource_types | |
} | |
} |
all_supported = var.enable_exclusion == true || var.enable_inclusion == true ? false : true | ||
|
||
recording_strategy { | ||
use_only = var.enable_exclusion == true ? "EXCLUSION_BY_RESOURCE_TYPES" : (var.enable_inclusion == true ? "INCLUSION_BY_RESOURCE_TYPES" : "ALL_SUPPORTED_RESOURCE_TYPES") |
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.
use_only = var.enable_exclusion == true ? "EXCLUSION_BY_RESOURCE_TYPES" : (var.enable_inclusion == true ? "INCLUSION_BY_RESOURCE_TYPES" : "ALL_SUPPORTED_RESOURCE_TYPES") | |
use_only = var.enable_exclusion ? "EXCLUSION_BY_RESOURCE_TYPES" : (var.enable_inclusion ? "INCLUSION_BY_RESOURCE_TYPES" : "ALL_SUPPORTED_RESOURCE_TYPES") |
💥 This pull request now has conflicts. Could you fix it @babychm? 🙏 |
This PR was closed due to inactivity and merge conflicts. 😭 |
what
Added ability to conditionally determine the recording strategy, record all types of resources, include or exclude resources from the recording group by the provided list.
why
references