Guard offers a policy-as-code domain-specific language (DSL) to write rules and validate JSON- and YAML-formatted data such as CloudFormation Templates, K8s configurations, and Terraform JSON plans/configurations against those rules. Take this survey to provide feedback about cfn-guard: https://amazonmr.au1.qualtrics.com/jfe/form/SV_bpyzpfoYGGuuUl0
Apache License 2.0
1.3k
stars
180
forks
source link
[Enhancement] Introduce date-time and or parse_timestamp (to epoch) function (parser). #521
Is your feature request related to a problem? Please describe.
We would like to have the ability to parse date-time values to epoch for comparison purposes. For example...
Parse date-time values out of date-time fields as numbers.
Validate that date-time values for a schedule feature in a service are x units in the future.
Validate misc. properties on resources are at some value IF a particular resource was updated after xupdate-time.
Filter versions of certain resources (where versions are represented as yyyy-mm-dd vs "v1", etc).
Parse date-times out of fields such as Tags and or potentially Descriptions of certain resources if used in this manner.
Validate Template parameters if used in automation and injected by automation.
Describe the solution you'd like
It would be be nice if there were a way to parse timestamps (represented as strings) in templates now into values we would use. The simplest approach would be to introduce a parse_epoch or parse_iso8601_epoch function to the existing set of functions which would enable simple numbers comparisons at the very least.
Describe alternatives you've considered
In theory all sorts of date-time functions could be supported within Guard, however a simple parser for epoch time would be a reasonable start.
Is your feature request related to a problem? Please describe.
We would like to have the ability to parse date-time values to epoch for comparison purposes. For example...
x
units in the future.x
update-time
.yyyy-mm-dd
vs "v1", etc).Tags
and or potentiallyDescriptions
of certain resources if used in this manner.Describe the solution you'd like
It would be be nice if there were a way to parse timestamps (represented as strings) in templates now into values we would use. The simplest approach would be to introduce a
parse_epoch
orparse_iso8601_epoch
function to the existing set of functions which would enable simple numbers comparisons at the very least.Describe alternatives you've considered
In theory all sorts of date-time functions could be supported within Guard, however a simple parser for epoch time would be a reasonable start.
Additional context
N/A for the moment.