Stuck on setting range for integer string Sentinel

I’m trying to set KMS key rotation for GCP, but terraform only allows integers with “s” attached making it a string for the KMS resource. Like “1000s” instead of “1000”. Again, I’ve been working on this with my team for hours but we’re all stuck. I’ve attached the playground and it gives a tfplan error, but the code works if you properly import it.

I need a range between 1-100000s, not only 100000s. I can’t seem to do that with the “s” at the tail. Any help would be appreciated.

Ignore the “aws_s3_buckets” variable names as I reused a code already present here.


I think this is what you want: Sentinel Playground

Essentially, I have created a range based on what I believe the requirements are, and then I’m using the strings import with type conversion to get an integer value. I then check if the integer is in the range provided.

1 Like

Had a similar solution mocked up using regex - but looks like Ryan posted a nice solution first.

See this example: Sentinel Playground

1 Like