Closed nick-zh closed 2 years ago
Files identified in the description:
plugins/modules/cloudfront_distribution.py
](https://github.com/['ansible-collections/amazon.aws', 'ansible-collections/community.aws', 'ansible-collections/community.vmware']/blob/main/plugins/modules/cloudfront_distribution.py)If these files are inaccurate, please update the component name
section of the description or use the !component
bot command.
cc @jillr @markuman @s-hertel @tremble @wilvk @wimnat click here for bot help
@nick-zh I may be wrong but I think based on what I can tell s3_origin_access_identity_enabled
is intended for use in the module logic only as a flag:
Use an origin access identity to configure the origin so that viewers can only access objects in an Amazon S3 bucket > through CloudFront. Will automatically create an Identity for you if no s3_origin_config is specified.
If you use that option then I think you also need to set: https://docs.ansible.com/ansible/latest/collections/community/aws/cloudfront_distribution_module.html#parameter-origins/s3_origin_config
Without setting it, then it looks like that flag is passed in the API request to AWS, which is then causing that error. So I think it's partially a case of missing config in your task and partially a bug.
@marknet15 many thanks for looking into it. I guess this was an oversight no my part :+1: with the next case i have i'll check if that works, but i am pretty sure it will :smile:
@marknet15 took me a while to setup a new project using this, so it seems i might be reading the doc wrong again, i tried the following:
- name: create a basic distribution with defaults and tags
community.aws.cloudfront_distribution:
state: present
comment: example.com
aliases:
- example.com
origins:
- id: 'S3-example.com'
domain_name: example.com.s3.eu-west-1.amazonaws.com
origin_path: /index.html
s3_origin_access_identity_enabled: true
s3_origin_config:
origin_access_identity: origin-access-identity/cloudfront/<myOAI-id>
but i get:
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: Unknown parameter in DistributionConfig.Origins.Items[0]: "S3OriginAccessIdentityEnabled", must be one of: Id, DomainName, OriginPath, CustomHeaders, S3OriginConfig, CustomOriginConfig, ConnectionAttempts, ConnectionTimeout, OriginShield
fatal: [localhost]: FAILED! => {"boto3_version": "1.18.47", "botocore_version": "1.21.47", "changed": false, "msg": "Error creating distribution: Parameter validation failed:\nUnknown parameter in DistributionConfig.Origins.Items[0]: \"S3OriginAccessIdentityEnabled\", must be one of: Id, DomainName, OriginPath, CustomHeaders, S3OriginConfig, CustomOriginConfig, ConnectionAttempts, ConnectionTimeout, OriginShield"}
Thanks in advance for helping me figure this out :pray:
Summary
Doc states that
s3_origin_access_identity_enabled
is a bool A bool results for me in the following error:I also tried creating an oai with
community.aws.cloudfront_origin_access_identity
and adding an id, same result.Issue Type
Bug Report
Component Name
cloudfront_distribution
Ansible Version
Collection Versions
AWS SDK versions
Configuration
OS / Environment
No response
Steps to Reproduce
Expected Results
A created cloudfront disribution
Actual Results
Code of Conduct