Skip to content
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

{now} does not expand in value_from.url when running in serverless mode #8873

Open
huynhsontung opened this issue Aug 24, 2023 · 1 comment
Assignees
Labels

Comments

@huynhsontung
Copy link
Contributor

huynhsontung commented Aug 24, 2023

Describe the bug

I have a filter that gets value from an S3 object with a key that contains the current date.

value_from:
    format: txt
    url: s3://custodian-integrations/amis/{now:%Y-%m-%d}/preprod.txt

Before I could use {now} in the S3 URL but after updating to the latest version (c7n==0.9.30), {now} doesn't expand anymore and the policy errors out as it can't find the object. This issue only exists in periodic mode, pull mode expands the URL normally.

What did you expect to happen?

{now} should expand for value_from.url in a filter when running in serverless mode.

Cloud Provider

Amazon Web Services (AWS)

Cloud Custodian version and dependency information

c7n==0.9.30

Policy

name: ami-list-test
resource: ami
filters:
  - type: value
    key: "ImageId"
    op: in
    value_from:
      format: txt
      url: s3://custodian-integrations/amis/{now:%Y-%m-%d}/preprod.txt
mode:
  type: periodic
  schedule: "cron(10 23 ? * 1 *)"

Extra information or context

I am quite certain that the issue originated from #8509. Downgrading to 0.9.26 fixed the issue.

@kapilt
Copy link
Collaborator

kapilt commented Aug 27, 2023

hmm.. that's odd, and worth investigating, the purpose of #8509 was to defer expanding now till server less policy execution, it was previously expanding at provisioning time for the function.

@ajkerrigan ajkerrigan self-assigned this Sep 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants