community.general.scaleway_function (8.5.0) — module

Scaleway Function management

| "added in version" 6.0.0 of community.general"

Authors: Guillaume MARTINEZ (@Lunik)

Install collection

Install with ansible-galaxy collection install community.general:==8.5.0


Add to requirements.yml

  collections:
    - name: community.general
      version: 8.5.0

Description

This module manages function on Scaleway account.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create a function
  community.general.scaleway_function:
    namespace_id: '{{ scw_function_namespace }}'
    region: fr-par
    state: present
    name: my-awesome-function
    runtime: python3
    environment_variables:
      MY_VAR: my_value
    secret_environment_variables:
      MY_SECRET_VAR: my_secret_value
  register: function_creation_task
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Make sure function is deleted
  community.general.scaleway_function:
    namespace_id: '{{ scw_function_namespace }}'
    region: fr-par
    state: absent
    name: my-awesome-function

Inputs

    
name:
    description:
    - Name of the function.
    required: true
    type: str

wait:
    default: true
    description:
    - Wait for the resource to reach its desired state before returning.
    type: bool

state:
    choices:
    - present
    - absent
    default: present
    description:
    - Indicate desired state of the function.
    type: str

region:
    choices:
    - fr-par
    - nl-ams
    - pl-waw
    description:
    - Scaleway region to use (for example V(fr-par)).
    required: true
    type: str

api_url:
    aliases:
    - base_url
    default: https://api.scaleway.com
    description:
    - Scaleway API URL.
    type: str

handler:
    description:
    - The C(module-name.export) value in your function.
    type: str

privacy:
    choices:
    - public
    - private
    default: public
    description:
    - Privacy policies define whether a function can be executed anonymously.
    - Choose V(public) to enable anonymous execution, or V(private) to protect your function
      with an authentication mechanism provided by the Scaleway API.
    type: str

runtime:
    description:
    - Runtime of the function
    - See U(https://www.scaleway.com/en/docs/compute/functions/reference-content/functions-lifecycle/)
      for all available runtimes
    required: true
    type: str

redeploy:
    default: false
    description:
    - Redeploy the function if update is required.
    type: bool

api_token:
    aliases:
    - oauth_token
    description:
    - Scaleway OAuth token.
    required: true
    type: str

max_scale:
    description:
    - Maximum number of replicas for the function.
    type: int

min_scale:
    description:
    - Minimum number of replicas for the function.
    type: int

api_timeout:
    aliases:
    - timeout
    default: 30
    description:
    - HTTP timeout to Scaleway API in seconds.
    type: int

description:
    default: ''
    description:
    - Description of the function.
    type: str

memory_limit:
    description:
    - Resources define performance characteristics of your function.
    - They are allocated to your function at runtime.
    type: int

namespace_id:
    description:
    - Function namespace identifier.
    required: true
    type: str

wait_timeout:
    default: 300
    description:
    - Time to wait for the resource to reach the expected state.
    required: false
    type: int

validate_certs:
    default: true
    description:
    - Validate SSL certs of the Scaleway API.
    type: bool

wait_sleep_time:
    default: 3
    description:
    - Time to wait before every attempt to check the state of the resource.
    required: false
    type: int

function_timeout:
    description:
    - The length of time your handler can spend processing a request before being stopped.
    type: str

query_parameters:
    default: {}
    description:
    - List of parameters passed to the query string.
    type: dict

environment_variables:
    default: {}
    description:
    - Environment variables of the function.
    - Injected in function at runtime.
    type: dict

secret_environment_variables:
    default: {}
    description:
    - Secret environment variables of the function.
    - Updating those values will not output a C(changed) state in Ansible.
    - Injected in function at runtime.
    type: dict

Outputs

function:
  description: The function information.
  returned: when O(state=present)
  sample:
    cpu_limit: 140
    description: Function used for testing scaleway_function ansible module
    domain_name: fnansibletestfxamabuc-fn-ansible-test.functions.fnc.fr-par.scw.cloud
    environment_variables:
      MY_VAR: my_value
    error_message: null
    handler: handler.handle
    http_option: ''
    id: ceb64dc4-4464-4196-8e20-ecef705475d3
    max_scale: 5
    memory_limit: 256
    min_scale: 0
    name: fn-ansible-test
    namespace_id: 82737d8d-0ebb-4d89-b0ad-625876eca50d
    privacy: public
    region: fr-par
    runtime: python310
    runtime_message: ''
    secret_environment_variables:
    - key: MY_SECRET_VAR
      value: $argon2id$v=19$m=65536,t=1,p=2$tb6UwSPWx/rH5Vyxt9Ujfw$5ZlvaIjWwNDPxD9Rdght3NarJz4IETKjpvAU3mMSmFg
    status: created
    timeout: 300s
  type: dict