oracle.oci.oci_network_ip_sec_connection – Manage an IpSecConnection resource in Oracle Cloud Infrastructure

Note

This plugin is part of the oracle.oci collection (version 4.14.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 oracle.oci.

To use it in a playbook, specify: oracle.oci.oci_network_ip_sec_connection.

New in version 2.9.0: of oracle.oci

Synopsis

  • This module allows the user to create, update and delete an IpSecConnection resource in Oracle Cloud Infrastructure

  • For state=present, creates a new IPSec connection between the specified DRG and CPE. For more information, see Site-to-Site VPN Overview.

  • If you configure at least one tunnel to use static routing, then in the request you must provide at least one valid static route (you’re allowed a maximum of 10). For example: 10.0.0.0/16. If you configure both tunnels to use BGP dynamic routing, you can provide an empty list for the static routes. For more information, see the important note in IPSecConnection.

  • For the purposes of access control, you must provide the OCID of the compartment where you want the IPSec connection to reside. Notice that the IPSec connection doesn’t have to be in the same compartment as the DRG, CPE, or other Networking Service components. If you’re not sure which compartment to use, put the IPSec connection in the same compartment as the DRG. For more information about compartments and access control, see Overview of the IAM Service.

  • You may optionally specify a display name for the IPSec connection, otherwise a default is provided. It does not have to be unique, and you can change it. Avoid entering confidential information.

  • After creating the IPSec connection, you need to configure your on-premises router with tunnel-specific information. For tunnel status and the required configuration information, see:

  • For each tunnel, you need the IP address of Oracle’s VPN headend and the shared secret (that is, the pre-shared key). For more information, see CPE Configuration.

  • This resource has the following action operations in the oracle.oci.oci_network_ip_sec_connection_actions module: change_compartment.

Requirements

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

Parameters

Parameter Choices/Defaults Comments
api_user
string
The OCID of the user, on whose behalf, OCI APIs are invoked. If not set, then the value of the OCI_USER_ID environment variable, if any, is used. This option is required if the user is not specified through a configuration file (See config_file_location). To get the user's OCID, please refer https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/apisigningkey.htm.
api_user_fingerprint
string
Fingerprint for the key pair being used. If not set, then the value of the OCI_USER_FINGERPRINT environment variable, if any, is used. This option is required if the key fingerprint is not specified through a configuration file (See config_file_location). To get the key pair's fingerprint value please refer https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/apisigningkey.htm.
api_user_key_file
string
Full path and filename of the private key (in PEM format). If not set, then the value of the OCI_USER_KEY_FILE variable, if any, is used. This option is required if the private key is not specified through a configuration file (See config_file_location). If the key is encrypted with a pass-phrase, the api_user_key_pass_phrase option must also be provided.
api_user_key_pass_phrase
string
Passphrase used by the key referenced in api_user_key_file, if it is encrypted. If not set, then the value of the OCI_USER_KEY_PASS_PHRASE variable, if any, is used. This option is required if the key passphrase is not specified through a configuration file (See config_file_location).
auth_purpose
string
    Choices:
  • service_principal
The auth purpose which can be used in conjunction with 'auth_type=instance_principal'. The default auth_purpose for instance_principal is None.
auth_type
string
    Choices:
  • api_key ←
  • instance_principal
  • instance_obo_user
  • resource_principal
The type of authentication to use for making API requests. By default auth_type="api_key" based authentication is performed and the API key (see api_user_key_file) in your config file will be used. If this 'auth_type' module option is not specified, the value of the OCI_ANSIBLE_AUTH_TYPE, if any, is used. Use auth_type="instance_principal" to use instance principal based authentication when running ansible playbooks within an OCI compute instance.
cert_bundle
string
The full path to a CA certificate bundle to be used for SSL verification. This will override the default CA certificate bundle. If not set, then the value of the OCI_ANSIBLE_CERT_BUNDLE variable, if any, is used.
compartment_id
string
The OCID of the compartment to contain the IPSec connection.
Required for create using state=present.
Required for update when environment variable OCI_USE_NAME_AS_IDENTIFIER is set.
Required for delete when environment variable OCI_USE_NAME_AS_IDENTIFIER is set.
config_file_location
string
Path to configuration file. If not set then the value of the OCI_CONFIG_FILE environment variable, if any, is used. Otherwise, defaults to ~/.oci/config.
config_profile_name
string
The profile to load from the config file referenced by config_file_location. If not set, then the value of the OCI_CONFIG_PROFILE environment variable, if any, is used. Otherwise, defaults to the "DEFAULT" profile in config_file_location.
cpe_id
string
The OCID of the Cpe object.
Required for create using state=present.
cpe_local_identifier
string
Your identifier for your CPE device. Can be either an IP address or a hostname (specifically, the fully qualified domain name (FQDN)). The type of identifier you provide here must correspond to the value for `cpeLocalIdentifierType`.
If you don't provide a value, the `ipAddress` attribute for the Cpe object specified by `cpeId` is used as the `cpeLocalIdentifier`.
For information about why you'd provide this value, see If Your CPE Is Behind a NAT Device.
Example IP address: `10.0.3.3`
Example hostname: `cpe.example.com`
This parameter is updatable.
cpe_local_identifier_type
string
    Choices:
  • IP_ADDRESS
  • HOSTNAME
The type of identifier for your CPE device. The value you provide here must correspond to the value for `cpeLocalIdentifier`.
This parameter is updatable.
defined_tags
dictionary
Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags.
Example: `{"Operations": {"CostCenter": "42"}}`
This parameter is updatable.
display_name
string
A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.
Required for create, update, delete when environment variable OCI_USE_NAME_AS_IDENTIFIER is set.
This parameter is updatable when OCI_USE_NAME_AS_IDENTIFIER is not set.

aliases: name
drg_id
string
The OCID of the DRG.
Required for create using state=present.
force_create
boolean
    Choices:
  • no ←
  • yes
Whether to attempt non-idempotent creation of a resource. By default, create resource is an idempotent operation, and doesn't create the resource if it already exists. Setting this option to true, forcefully creates a copy of the resource, even if it already exists.This option is mutually exclusive with key_by.
freeform_tags
dictionary
Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags.
Example: `{"Department": "Finance"}`
This parameter is updatable.
ipsc_id
string
The OCID of the IPSec connection.
Required for update using state=present when environment variable OCI_USE_NAME_AS_IDENTIFIER is not set.
Required for delete using state=absent when environment variable OCI_USE_NAME_AS_IDENTIFIER is not set.

aliases: id
key_by
list / elements=string
The list of attributes of this resource which should be used to uniquely identify an instance of the resource. By default, all the attributes of a resource are used to uniquely identify a resource.
region
string
The Oracle Cloud Infrastructure region to use for all OCI API requests. If not set, then the value of the OCI_REGION variable, if any, is used. This option is required if the region is not specified through a configuration file (See config_file_location). Please refer to https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/regions.htm for more information on OCI regions.
state
string
    Choices:
  • present ←
  • absent
The state of the IpSecConnection.
Use state=present to create or update an IpSecConnection.
Use state=absent to delete an IpSecConnection.
static_routes
list / elements=string
Static routes to the CPE. A static route's CIDR must not be a multicast address or class E address.
Used for routing a given IPSec tunnel's traffic only if the tunnel is using static routing. If you configure at least one tunnel to use static routing, then you must provide at least one valid static route. If you configure both tunnels to use BGP dynamic routing, you can provide an empty list for the static routes. For more information, see the important note in IPSecConnection.
The CIDR can be either IPv4 or IPv6. IPv6 addressing is supported for all commercial and government regions. See IPv6 Addresses.
Example: `10.0.1.0/24`
Example: `2001:db8::/32`
Required for create using state=present.
This parameter is updatable.
tenancy
string
OCID of your tenancy. If not set, then the value of the OCI_TENANCY variable, if any, is used. This option is required if the tenancy OCID is not specified through a configuration file (See config_file_location). To get the tenancy OCID, please refer https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/apisigningkey.htm
tunnel_configuration
list / elements=dictionary
Information for creating the individual tunnels in the IPSec connection. You can provide a maximum of 2 `tunnelConfiguration` objects in the array (one for each of the two tunnels).
bgp_session_config
dictionary
customer_bgp_asn
string
If the tunnel's `routing` attribute is set to `BGP` (see IPSecConnectionTunnel), this ASN is required and used for the tunnel's BGP session. This is the ASN of the network on the CPE end of the BGP session. Can be a 2-byte or 4-byte ASN. Uses "asplain" format.
If the tunnel's `routing` attribute is set to `STATIC`, the `customerBgpAsn` must be null.
Example: `12345` (2-byte) or `1587232876` (4-byte)
customer_interface_ip
string
The IP address for the CPE end of the inside tunnel interface.
If the tunnel's `routing` attribute is set to `BGP` (see IPSecConnectionTunnel), this IP address is required and used for the tunnel's BGP session.
If `routing` is instead set to `STATIC`, this IP address is optional. You can set this IP address to troubleshoot or monitor the tunnel.
The value must be a /30 or /31.
Example: `10.0.0.5/31`
customer_interface_ipv6
string
The IPv6 address for the CPE end of the inside tunnel interface. This IP address is optional.
If the tunnel's `routing` attribute is set to `BGP` (see IPSecConnectionTunnel), this IP address is used for the tunnel's BGP session.
If `routing` is instead set to `STATIC`, you can set this IP address to troubleshoot or monitor the tunnel.
Only subnet masks from /64 up to /127 are allowed.
Example: `2001:db8::1/64`
oracle_interface_ip
string
The IP address for the Oracle end of the inside tunnel interface.
If the tunnel's `routing` attribute is set to `BGP` (see IPSecConnectionTunnel), this IP address is required and used for the tunnel's BGP session.
If `routing` is instead set to `STATIC`, this IP address is optional. You can set this IP address to troubleshoot or monitor the tunnel.
The value must be a /30 or /31.
Example: `10.0.0.4/31`
oracle_interface_ipv6
string
The IPv6 address for the Oracle end of the inside tunnel interface. This IP address is optional.
If the tunnel's `routing` attribute is set to `BGP` (see IPSecConnectionTunnel), this IP address is used for the tunnel's BGP session.
If `routing` is instead set to `STATIC`, you can set this IP address to troubleshoot or monitor the tunnel.
Only subnet masks from /64 up to /127 are allowed.
Example: `2001:db8::1/64`
display_name
string
A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.

aliases: name
dpd_config
dictionary
dpd_mode
string
    Choices:
  • INITIATE_AND_RESPOND
  • RESPOND_ONLY
This option defines whether DPD can be initiated from the Oracle side of the connection.
dpd_timeout_in_sec
integer
DPD timeout in seconds. This sets the longest interval between CPE device health messages before the IPSec connection indicates it has lost contact with the CPE. The default is 20 seconds.
encryption_domain_config
dictionary
cpe_traffic_selector
list / elements=string
Lists IPv4 or IPv6-enabled subnets in your on-premises network.
oracle_traffic_selector
list / elements=string
Lists IPv4 or IPv6-enabled subnets in your Oracle tenancy.
ike_version
string
    Choices:
  • V1
  • V2
Internet Key Exchange protocol version.
nat_translation_enabled
string
    Choices:
  • ENABLED
  • DISABLED
  • AUTO
By default (the `AUTO` setting), IKE sends packets with a source and destination port set to 500, and when it detects that the port used to forward packets has changed (most likely because a NAT device is between the CPE device and the Oracle VPN headend) it will try to negotiate the use of NAT-T.
The `ENABLED` option sets the IKE protocol to use port 4500 instead of 500 and forces encapsulating traffic with the ESP protocol inside UDP packets.
The `DISABLED` option directs IKE to completely refuse to negotiate NAT-T even if it senses there may be a NAT device in use.
oracle_initiation
string
    Choices:
  • INITIATOR_OR_RESPONDER
  • RESPONDER_ONLY
Indicates whether the Oracle end of the IPSec connection is able to initiate starting up the IPSec tunnel.
phase_one_config
dictionary
authentication_algorithm
string
    Choices:
  • SHA2_384
  • SHA2_256
  • SHA1_96
The custom authentication algorithm proposed during phase one tunnel negotiation.
diffie_helman_group
string
    Choices:
  • GROUP2
  • GROUP5
  • GROUP14
  • GROUP19
  • GROUP20
  • GROUP24
The custom Diffie-Hellman group proposed during phase one tunnel negotiation.
encryption_algorithm
string
    Choices:
  • AES_256_CBC
  • AES_192_CBC
  • AES_128_CBC
The custom encryption algorithm proposed during phase one tunnel negotiation.
is_custom_phase_one_config
boolean
    Choices:
  • no
  • yes
Indicates whether custom configuration is enabled for phase one options.
lifetime_in_seconds
integer
Internet key association (IKE) session key lifetime in seconds for IPSec phase one. The default is 28800 which is equivalent to 8 hours.
phase_two_config
dictionary
authentication_algorithm
string
    Choices:
  • HMAC_SHA2_256_128
  • HMAC_SHA1_128
The authentication algorithm proposed during phase two tunnel negotiation.
encryption_algorithm
string
    Choices:
  • AES_256_GCM
  • AES_192_GCM
  • AES_128_GCM
  • AES_256_CBC
  • AES_192_CBC
  • AES_128_CBC
The encryption algorithm proposed during phase two tunnel negotiation.
is_custom_phase_two_config
boolean
    Choices:
  • no
  • yes
Indicates whether custom configuration is enabled for phase two options.
is_pfs_enabled
boolean
    Choices:
  • no
  • yes
Indicates whether perfect forward secrecy (PFS) is enabled.
lifetime_in_seconds
integer
Lifetime in seconds for the IPSec session key set in phase two. The default is 3600 which is equivalent to 1 hour.
pfs_dh_group
string
    Choices:
  • GROUP2
  • GROUP5
  • GROUP14
  • GROUP19
  • GROUP20
  • GROUP24
The Diffie-Hellman group used for PFS, if PFS is enabled.
routing
string
    Choices:
  • BGP
  • STATIC
  • POLICY
The type of routing to use for this tunnel (BGP dynamic routing, static routing, or policy-based routing).
shared_secret
string
The shared secret (pre-shared key) to use for the IPSec tunnel. Only numbers, letters, and spaces are allowed. If you don't provide a value, Oracle generates a value for you. You can specify your own shared secret later if you like with UpdateIPSecConnectionTunnelSharedSecret.
wait
boolean
    Choices:
  • no
  • yes ←
Whether to wait for create or delete operation to complete.
wait_timeout
integer
Time, in seconds, to wait when wait=yes. Defaults to 1200 for most of the services but some services might have a longer wait timeout.

Examples

- name: Create ip_sec_connection
  oci_network_ip_sec_connection:
    # required
    compartment_id: "ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx"
    cpe_id: "ocid1.cpe.oc1..xxxxxxEXAMPLExxxxxx"
    drg_id: "ocid1.drg.oc1..xxxxxxEXAMPLExxxxxx"
    static_routes: [ "static_routes_example" ]

    # optional
    tunnel_configuration:
    - # optional
      display_name: display_name_example
      routing: BGP
      ike_version: V1
      shared_secret: shared_secret_example
      bgp_session_config:
        # optional
        oracle_interface_ip: oracle_interface_ip_example
        customer_interface_ip: customer_interface_ip_example
        oracle_interface_ipv6: oracle_interface_ipv6_example
        customer_interface_ipv6: customer_interface_ipv6_example
        customer_bgp_asn: customer_bgp_asn_example
      oracle_initiation: INITIATOR_OR_RESPONDER
      nat_translation_enabled: ENABLED
      phase_one_config:
        # optional
        is_custom_phase_one_config: true
        authentication_algorithm: SHA2_384
        encryption_algorithm: AES_256_CBC
        diffie_helman_group: GROUP2
        lifetime_in_seconds: 56
      phase_two_config:
        # optional
        is_custom_phase_two_config: true
        authentication_algorithm: HMAC_SHA2_256_128
        encryption_algorithm: AES_256_GCM
        lifetime_in_seconds: 56
        is_pfs_enabled: true
        pfs_dh_group: GROUP2
      dpd_config:
        # optional
        dpd_mode: INITIATE_AND_RESPOND
        dpd_timeout_in_sec: 56
      encryption_domain_config:
        # optional
        oracle_traffic_selector: [ "oracle_traffic_selector_example" ]
        cpe_traffic_selector: [ "cpe_traffic_selector_example" ]
    defined_tags: {'Operations': {'CostCenter': 'US'}}
    display_name: display_name_example
    freeform_tags: {'Department': 'Finance'}
    cpe_local_identifier: cpe_local_identifier_example
    cpe_local_identifier_type: IP_ADDRESS

- name: Update ip_sec_connection
  oci_network_ip_sec_connection:
    # required
    ipsc_id: "ocid1.ipsc.oc1..xxxxxxEXAMPLExxxxxx"

    # optional
    defined_tags: {'Operations': {'CostCenter': 'US'}}
    display_name: display_name_example
    freeform_tags: {'Department': 'Finance'}
    cpe_local_identifier: cpe_local_identifier_example
    cpe_local_identifier_type: IP_ADDRESS
    static_routes: [ "static_routes_example" ]

- name: Update ip_sec_connection using name (when environment variable OCI_USE_NAME_AS_IDENTIFIER is set)
  oci_network_ip_sec_connection:
    # required
    compartment_id: "ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx"
    display_name: display_name_example

    # optional
    defined_tags: {'Operations': {'CostCenter': 'US'}}
    freeform_tags: {'Department': 'Finance'}
    cpe_local_identifier: cpe_local_identifier_example
    cpe_local_identifier_type: IP_ADDRESS
    static_routes: [ "static_routes_example" ]

- name: Delete ip_sec_connection
  oci_network_ip_sec_connection:
    # required
    ipsc_id: "ocid1.ipsc.oc1..xxxxxxEXAMPLExxxxxx"
    state: absent

- name: Delete ip_sec_connection using name (when environment variable OCI_USE_NAME_AS_IDENTIFIER is set)
  oci_network_ip_sec_connection:
    # required
    compartment_id: "ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx"
    display_name: display_name_example
    state: absent

Return Values

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

Key Returned Description
ip_sec_connection
complex
on success
Details of the IpSecConnection resource acted upon by the current operation

Sample:
{'compartment_id': 'ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx', 'cpe_id': 'ocid1.cpe.oc1..xxxxxxEXAMPLExxxxxx', 'cpe_local_identifier': 'cpe_local_identifier_example', 'cpe_local_identifier_type': 'IP_ADDRESS', 'defined_tags': {'Operations': {'CostCenter': 'US'}}, 'display_name': 'display_name_example', 'drg_id': 'ocid1.drg.oc1..xxxxxxEXAMPLExxxxxx', 'freeform_tags': {'Department': 'Finance'}, 'id': 'ocid1.resource.oc1..xxxxxxEXAMPLExxxxxx', 'lifecycle_state': 'PROVISIONING', 'static_routes': [], 'time_created': '2013-10-20T19:20:30+01:00'}
 
compartment_id
string
on success
The OCID of the compartment containing the IPSec connection.

Sample:
ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx
 
cpe_id
string
on success
The OCID of the Cpe object.

Sample:
ocid1.cpe.oc1..xxxxxxEXAMPLExxxxxx
 
cpe_local_identifier
string
on success
Your identifier for your CPE device. Can be either an IP address or a hostname (specifically, the fully qualified domain name (FQDN)). The type of identifier here must correspond to the value for `cpeLocalIdentifierType`.
If you don't provide a value when creating the IPSec connection, the `ipAddress` attribute for the Cpe object specified by `cpeId` is used as the `cpeLocalIdentifier`.
For information about why you'd provide this value, see If Your CPE Is Behind a NAT Device.
Example IP address: `10.0.3.3`
Example hostname: `cpe.example.com`

Sample:
cpe_local_identifier_example
 
cpe_local_identifier_type
string
on success
The type of identifier for your CPE device. The value here must correspond to the value for `cpeLocalIdentifier`.

Sample:
IP_ADDRESS
 
defined_tags
dictionary
on success
Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags.
Example: `{"Operations": {"CostCenter": "42"}}`

Sample:
{'Operations': {'CostCenter': 'US'}}
 
display_name
string
on success
A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.

Sample:
display_name_example
 
drg_id
string
on success
The OCID of the DRG.

Sample:
ocid1.drg.oc1..xxxxxxEXAMPLExxxxxx
 
freeform_tags
dictionary
on success
Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags.
Example: `{"Department": "Finance"}`

Sample:
{'Department': 'Finance'}
 
id
string
on success
The IPSec connection's Oracle ID (OCID).

Sample:
ocid1.resource.oc1..xxxxxxEXAMPLExxxxxx
 
lifecycle_state
string
on success
The IPSec connection's current state.

Sample:
PROVISIONING
 
static_routes
list / elements=string
on success
Static routes to the CPE. The CIDR must not be a multicast address or class E address.
Used for routing a given IPSec tunnel's traffic only if the tunnel is using static routing. If you configure at least one tunnel to use static routing, then you must provide at least one valid static route. If you configure both tunnels to use BGP dynamic routing, you can provide an empty list for the static routes.
The CIDR can be either IPv4 or IPv6. IPv6 addressing is supported for all commercial and government regions. See IPv6 Addresses.
Example: `10.0.1.0/24`
Example: `2001:db8::/32`

 
time_created
string
on success
The date and time the IPSec connection was created, in the format defined by RFC3339.
Example: `2016-08-25T21:10:29.600Z`

Sample:
2013-10-20T19:20:30+01:00


Authors

  • Oracle (@oracle)