Failed to create stack lambda-layer-test5: An error occurred (ValidationError) when calling the CreateStack operation: ParameterValue for ParameterKey Content is required

  • name: Deploy CloudFormation Stack
    cloudformation:
    stack_name: “{{ stack_name }}”
    state: present
    region: “{{ region }}”
    template: “{{ template }}”
    template_parameters:
    LayerName: “{{ item.1 }}”
    Runtime: “{{ item.0.name }}”
    Content:
    S3Bucket: “{{ s3bucket }}”
    S3Key: “{{ item.0.name }}-{{ item.1 }}-layer.zip”
    disable_rollback: true
    tags:
    Stack: “{{ tags.Stack }}”
    Environment: “{{ tags.Environment }}”
    loop: “{{ lambda_runtimes | subelements(‘layers’) }}”

Vars:

lambda_runtimes:

  • name: python310
    layers:
  • requests
  • name: python311
    layers:
  • urllib3
  • requests

stack_name: lambda-layer-test5
template: files/lambda_layer.yml
s3bucket: twe-enc-common-test-lambdalayer-org
region: “{{ aws_region }}”
aws_region: ap-southeast-2

tags:
Stack: stack_name
Environment: Dev

error:

botocore.exceptions.ClientError: An error occurred (ValidationError) when calling the CreateStack operation: ParameterValue for ParameterKey Content is required
failed: [localhost] (item=[{‘name’: ‘python310’, ‘layers’: [‘requests’]}, ‘requests’]) => {
“ansible_loop_var”: “item”,
“boto3_version”: “1.34.32”,
“botocore_version”: “1.34.32”,
“changed”: false,
“error”: {
“code”: “ValidationError”,
“message”: “ParameterValue for ParameterKey Content is required”,
“type”: “Sender”
},
“invocation”: {
“module_args”: {
“access_key”: null,
“aws_ca_bundle”: null,
“aws_config”: null,
“backoff_delay”: 3,
“backoff_max_delay”: 30,
“backoff_retries”: 10,
“capabilities”: [
“CAPABILITY_IAM”,
“CAPABILITY_NAMED_IAM”
],
“changeset_name”: null,
“create_changeset”: false,
“create_timeout”: null,
“debug_botocore_endpoint_logs”: false,
“disable_rollback”: true,
“endpoint_url”: null,
“events_limit”: 200,
“notification_arns”: null,
“on_create_failure”: null,
“profile”: “twe”,
“region”: “ap-southeast-2”,
“role_arn”: null,
“secret_key”: null,
“session_token”: null,
“stack_name”: “lambda-layer-test5”,
“stack_policy”: null,
“stack_policy_body”: null,
“stack_policy_on_update_body”: null,
“state”: “present”,
“tags”: {
“Environment”: “Dev”,
“Stack”: “stack_name”
},
“template”: “files/lambda_layer.yml”,
“template_body”: null,
“template_parameters”: {
“Content”: {
“S3Bucket”: “twe-enc-common-test-lambdalayer-org”,
“S3Key”: “python310-requests-layer.zip”
},
“LayerName”: “requests”,
“Runtime”: “python310”
},
“template_url”: null,
“termination_protection”: null,
“validate_certs”: true
}
},
“item”: [
{
“layers”: [
“requests”
],
“name”: “python310”
},
“requests”
],

any help duly appreciated…, its driving me nuts :frowning:

That error is coming from the CloudFormation template, not from the Ansible code. Review the template and confirm that you are passing all the required parameter values.

Rilindo