lib/sles4sap/qesap/aws.pm

NAME

AWS related functions for the qe-sap-deployment test lib

COPYRIGHT

Copyright 2025 SUSE LLC
SPDX-License-Identifier: FSFAP

AUTHORS

QE SAP <qe-sap@suse.de>

DESCRIPTION

Package with AWS related methods for qe-sap-deployment

Methods

qesap_aws_create_credentials

Creates a AWS credentials file as required by QE-SAP Terraform deployment code.
KEY - value for the aws_access_key_id
SECRET - value for the aws_secret_access_key
CONF_TRGT - qesap_conf_trgt value in the output of qesap_get_file_paths

qesap_aws_create_config

Creates a AWS configuration file in ~/.aws/config
as required by the QE-SAP Terraform & Ansible deployment code.
Content is mostly (only) about region.
REGION - cloud region as usually provided by PUBLIC_CLOUD_REGION

qesap_aws_get_vpc_id

Get the vpc_id of a given instance in the cluster.
This function looks for the cluster using the aws describe-instances
and filtering by terraform deployment_name value, that qe-sap-deployment
is kind to use as tag for each resource.
RESOURCE_GROUP - value of the workspace tag configured in qe-sap-deployment, usually it is the deployment name

qesap_aws_get_transit_gateway_vpc_attachment Ged a description of one or more transit-gateway-attachments Function support optional arguments that are translated to filters: - transit_gateway_attach_id - name

Example:
  qesap_aws_get_transit_gateway_vpc_attachment(name => 'SOMETHING')

  Result internally in aws cli to be called like

  aws ec2 describe-transit-gateway-attachments --filter='Name=tag:Name,Values=SOMETHING

Only one filter mode is supported at any time.

Returns a HASH reference to the decoded JSON returned by the AWS command or undef on failure.

qesap_aws_delete_transit_gateway_vpc_attachment

Call delete-transit-gateway-vpc-attachment and
wait until Transit Gateway Attachment is deleted.

Return 1 (true) if properly managed to delete the tgw-attachment OR 'wait' is 0
Return 0 (false) if wait=1 AND delete-transit-gateway-vpc-attachment fails or timeout is reached
ID - id of the TGW attachment to be deleted
TIMEOUT - default is 5 mins
WAIT - whether to wait to verify deleted status or not

qesap_aws_filter_query

Generic function to compose a aws cli command with:
  - `aws ec2` something
  - use both `filter` and `query`
  - has text output

qesap_aws_get_mirror_tg

Return the Transient Gateway ID of the IBS Mirror
MIRROR_TAG - Value of Project tag applied to the IBS Mirror