---

- name: "OCI Cloud Controller | Credentials Check | oci_private_key"
  fail:
    msg: "oci_private_key is missing"
  when:
    - not oci_use_instance_principals
    - oci_private_key is not defined or not oci_private_key

- name: "OCI Cloud Controller | Credentials Check | oci_region_id"
  fail:
    msg: "oci_region_id is missing"
  when:
    - not oci_use_instance_principals
    - oci_region_id is not defined or not oci_region_id

- name: "OCI Cloud Controller | Credentials Check | oci_tenancy_id"
  fail:
    msg: "oci_tenancy_id is missing"
  when:
    - not oci_use_instance_principals
    - oci_tenancy_id is not defined or not oci_tenancy_id

- name: "OCI Cloud Controller | Credentials Check | oci_user_id"
  fail:
    msg: "oci_user_id is missing"
  when:
    - not oci_use_instance_principals
    - oci_user_id is not defined or not oci_user_id

- name: "OCI Cloud Controller | Credentials Check | oci_user_fingerprint"
  fail:
    msg: "oci_user_fingerprint is missing"
  when:
    - not oci_use_instance_principals
    - oci_user_fingerprint is not defined or not oci_user_fingerprint

- name: "OCI Cloud Controller | Credentials Check | oci_compartment_id"
  fail:
    msg: "oci_compartment_id is missing. This is the compartment in which the cluster resides"
  when:
    - oci_compartment_id is not defined or not oci_compartment_id

- name: "OCI Cloud Controller | Credentials Check | oci_vnc_id"
  fail:
    msg: "oci_vnc_id is missing. This is the Virtual Cloud Network in which the cluster resides"
  when:
    - oci_vnc_id is not defined or not oci_vnc_id

- name: "OCI Cloud Controller | Credentials Check | oci_subnet1_id"
  fail:
    msg: "oci_subnet1_id is missingg. This is the first subnet to which loadbalancers will be added"
  when:
    - oci_subnet1_id is not defined or not oci_subnet1_id

- name: "OCI Cloud Controller | Credentials Check | oci_subnet2_id"
  fail:
    msg: "oci_subnet2_id is missing. Two subnets are required for load balancer high availability"
  when:
    - oci_cloud_controller_version | version_compare('0.7.0', '<')
    - oci_subnet2_id is not defined or not oci_subnet2_id

- name: "OCI Cloud Controller | Credentials Check | oci_security_list_management"
  fail:
    msg: "oci_security_list_management is missing, or not defined correctly. Valid options are (All, Frontend, None)."
  when:
    - oci_security_list_management is not defined or oci_security_list_management not in ["All", "Frontend", "None"]
