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

Error getting managed CloudFront policy UseOriginCacheControlHeaders-QueryStrings #5194

Open
tlinhart opened this issue Feb 11, 2025 · 0 comments
Labels
kind/bug Some behavior is incorrect or out of spec needs-triage Needs attention from the triage team

Comments

@tlinhart
Copy link

Describe what happened

According to the documentation, when using get_cache_policy or get_cache_policy_output function for managed policies, we should prefix the managed policy name with Managed-. This doesn't work for UseOriginCacheControlHeaders-QueryStrings policy, though, while it works for other policies. What does work is using UseOriginCacheControlHeaders-QueryStrings without prefix.

Sample program

This Pulumi program fails:

import pulumi
from pulumi_aws import cloudfront

policy = cloudfront.get_cache_policy_output(
    name="Managed-UseOriginCacheControlHeaders-QueryStrings"
)

pulumi.export("policy", policy.id)

Log output

Previewing update (dev):
     Type                 Name               Plan       Info
 +   pulumi:pulumi:Stack  cf-policy-bug-dev  create     1 error

Diagnostics:
  pulumi:pulumi:Stack (cf-policy-bug-dev):
    error: Program failed with an unhandled exception:
    Traceback (most recent call last):
      File "/home/user/.pulumi/bin/pulumi-language-python-exec", line 192, in <module>
        loop.run_until_complete(coro)
      File "/usr/lib/python3.12/asyncio/base_events.py", line 687, in run_until_complete
        return future.result()
               ^^^^^^^^^^^^^^^
      File "/home/user/tmp/cf-policy-bug/venv/lib/python3.12/site-packages/pulumi/runtime/stack.py", line 143, in run_in_stack
        await run_pulumi_func(run)
      File "/home/user/tmp/cf-policy-bug/venv/lib/python3.12/site-packages/pulumi/runtime/stack.py", line 55, in run_pulumi_func
        await wait_for_rpcs()
      File "/home/user/tmp/cf-policy-bug/venv/lib/python3.12/site-packages/pulumi/runtime/stack.py", line 119, in wait_for_rpcs
        await task
      File "/home/user/tmp/cf-policy-bug/venv/lib/python3.12/site-packages/pulumi/runtime/invoke.py", line 155, in do_invoke_output
        invoke_result = await _invoke(
                        ^^^^^^^^^^^^^^
      File "/home/user/tmp/cf-policy-bug/venv/lib/python3.12/site-packages/pulumi/runtime/invoke.py", line 367, in wait_for_fut
        return await asyncio.ensure_future(do_rpc())
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/home/user/tmp/cf-policy-bug/venv/lib/python3.12/site-packages/pulumi/runtime/invoke.py", line 363, in do_rpc
        raise error
    Exception: invoke of aws:cloudfront/getCachePolicy:getCachePolicy failed: invocation of aws:cloudfront/getCachePolicy:getCachePolicy returned an error: invoking aws:cloudfront/getCachePolicy:getCachePolicy: 1 error occurred:
    	* no matching CloudFront Cache Policy (Managed-UseOriginCacheControlHeaders-QueryStrings)

Affected Resource(s)

aws.cloudfront.get_cache_policy
aws.cloudfront.get_cache_policy_output

Output of pulumi about

CLI          
Version      3.145.0
Go Version   go1.23.4
Go Compiler  gc

Plugins
KIND      NAME    VERSION
resource  aws     6.68.0
language  python  3.145.0

Host     
OS       ubuntu
Version  24.04
Arch     x86_64

This project is written in python: executable='/home/user/tmp/cf-policy-bug/venv/bin/python' version='3.12.3'

Current Stack: organization/cf-policy-bug/dev

Found no resources associated with dev

Found no pending operations associated with dev

Backend        
Name           notebook
URL            file://~
User           user
Organizations  
Token type     personal

Dependencies:
NAME        VERSION
pulumi_aws  6.68.0
setuptools  75.8.0
wheel       0.45.1

Pulumi locates its logs in /tmp by default

Additional context

No response

Contributing

Vote on this issue by adding a 👍 reaction.
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

@tlinhart tlinhart added kind/bug Some behavior is incorrect or out of spec needs-triage Needs attention from the triage team labels Feb 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Some behavior is incorrect or out of spec needs-triage Needs attention from the triage team
Projects
None yet
Development

No branches or pull requests

1 participant