community.general.hwc_network_vpc module – Creates a Huawei Cloud VPC

Note

This module is part of the community.general collection (version 10.1.0).

You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install community.general. You need further requirements to be able to use this module, see Requirements for details.

To use it in a playbook, specify: community.general.hwc_network_vpc.

Synopsis

  • Represents an vpc resource.

Requirements

The below requirements are needed on the host that executes this module.

  • requests >= 2.18.4

  • keystoneauth1 >= 3.6.0

Parameters

Parameter

Comments

cidr

string / required

The range of available subnets in the vpc.

domain

string / required

The name of the Domain to scope to (Identity v3).

Currently only domain names are supported, and not domain IDs.

id

string

The ID of resource to be managed.

identity_endpoint

string / required

The Identity authentication URL.

name

string / required

The name of vpc.

password

string / required

The password to login with.

project

string / required

The name of the Tenant (Identity v2) or Project (Identity v3).

Currently only project names are supported, and not project IDs.

region

string

The region to which the project belongs.

state

string

Whether the given object should exist in vpc.

Choices:

  • "present" ← (default)

  • "absent"

timeouts

dictionary

The timeouts for each operations.

Default: {}

create

string

The timeout for create operation.

Default: "15m"

delete

string

The timeout for delete operation.

Default: "15m"

update

string

The timeout for update operation.

Default: "15m"

user

string / required

The user name to login with.

Currently only user names are supported, and not user IDs.

Attributes

Attribute

Support

Description

check_mode

Support: full

Can run in check_mode and return changed status prediction without modifying target.

diff_mode

Support: none

Will return details on what has changed (or possibly needs changing in check_mode), when in diff mode.

Notes

Note

  • For authentication, you can set identity_endpoint using the ANSIBLE_HWC_IDENTITY_ENDPOINT environment variable.

  • For authentication, you can set user using the ANSIBLE_HWC_USER environment variable.

  • For authentication, you can set password using the ANSIBLE_HWC_PASSWORD environment variable.

  • For authentication, you can set domain using the ANSIBLE_HWC_DOMAIN environment variable.

  • For authentication, you can set project using the ANSIBLE_HWC_PROJECT environment variable.

  • For authentication, you can set region using the ANSIBLE_HWC_REGION environment variable.

  • Environment variables values will only be used if the playbook values are not set.

Examples

- name: Create a vpc
  community.general.hwc_network_vpc:
      identity_endpoint: "{{ identity_endpoint }}"
      user: "{{ user }}"
      password: "{{ password }}"
      domain: "{{ domain }}"
      project: "{{ project }}"
      region: "{{ region }}"
      name: "vpc_1"
      cidr: "192.168.100.0/24"
      state: present

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key

Description

cidr

string

the range of available subnets in the vpc.

Returned: success

enable_shared_snat

boolean

show whether the shared snat is enabled.

Returned: success

id

string

the id of vpc.

Returned: success

name

string

the name of vpc.

Returned: success

routes

complex

the route information.

Returned: success

destination

string

the destination network segment of a route.

Returned: success

next_hop

string

the next hop of a route. If the route type is peering, it will provide VPC peering connection ID.

Returned: success

status

string

the status of vpc.

Returned: success

Authors

  • Huawei Inc. (@huaweicloud)