Skip to content

boto3_rds functions for creating DBin both execution and state module require a missing variable [BUG] #65463

@alan-cugler

Description

@alan-cugler

Description

AWS RDS requires a db_instance_identifier variable be filled out. I could be wrong about the issue, but it seems from looking at Boto and aws CLI docs this is a required parameter. I can not feed this required variable into the execution module's function boto_rds.create nor the state modules function boto_rds.present at present.

I checked the code in master branch and find it absent. But I did find an old issue that shows an output at the bottom of the conversation that the variable in question seemed to be filled in by a default as db_instance_identifier: RDS123456789.

current test code

# /srv/salt/state/hypervisor/rds.sls

install_pip_deps_boto3_aws:
  pip.installed:
    - pkgs:
      - boto3
      - boto

Ensure_dev_rds_exists:
  boto_rds.present:
    - name: Ensure_dev_rds_exists
    - db_name: dev_project
    - db_parameter_group_name: default.aurora-postgreql14
    - db_cluster_identifier: default.aurora-postgreql14
    - db_instance_class: db.serverless
    - availability_zone: us-east-2a
    - allocated_storage: 20
    - engine: aurora-postgresql
    - master_username: testguy
    - master_user_password: {{ pillar.dev_generated_aurora_db_password }}
    - port: 5432
    - key: {{ opts['iam.key'] }}
    - keyid: {{ opts['iam.keyid'] }}
    - region: {{ opts['iam.region'] }}

Environment

  • Ubuntu 22.04.2 ec2 instance on AWS
  • manual onedir installation of salt 3006.3
  • salt-minion and salt-master installed
  • IAM credentials and region are present in salt-minion's minion.d/

Version Report(s)

/srv/salt/state/hypervisor# salt --versions-report
Salt Version:
          Salt: 3006.3
 
Python Version:
        Python: 3.10.13 (main, Sep  6 2023, 02:11:27) [GCC 11.2.0]
 
Dependency Versions:
          cffi: 1.16.0
      cherrypy: Not Installed
      dateutil: 2.8.2
     docker-py: Not Installed
         gitdb: Not Installed
     gitpython: Not Installed
        Jinja2: 3.1.2
       libgit2: 1.7.1
  looseversion: 1.3.0
      M2Crypto: Not Installed
          Mako: Not Installed
       msgpack: 1.0.7
  msgpack-pure: Not Installed
  mysql-python: Not Installed
     packaging: 23.2
     pycparser: 2.21
      pycrypto: Not Installed
  pycryptodome: 3.19.0
        pygit2: 1.13.1
  python-gnupg: 0.5.1
        PyYAML: 6.0.1
         PyZMQ: 25.1.1
        relenv: 0.13.10
         smmap: Not Installed
       timelib: 0.2.4
       Tornado: 4.5.3
           ZMQ: 4.3.4
 
System Versions:
          dist: ubuntu 22.04.2 jammy
        locale: utf-8
       machine: x86_64
       release: 5.19.0-1025-aws
        system: Linux
       version: Ubuntu 22.04.2 jammy
/srv/salt/state# salt local-minion pip.list boto
local-minion:
    ----------
    boto:
        2.49.0
    boto3:
        1.28.70
    botocore:
        1.31.70

Terminal Error

/srv/salt/state/hypervisor# salt local-minion state.apply hypervisor.rds
local-minion:
----------
          ID: install_pip_deps_boto3_aws
    Function: pip.installed
      Result: True
     Comment: Python package boto3 was already installed
              Python package boto was already installed
              All specified packages are already installed
     Started: 17:04:56.113580
    Duration: 1736.764 ms
     Changes:   
----------
          ID: Ensure_dev_rds_exists
    Function: boto_rds.present
      Result: False
     Comment: Failed to create RDS instance An error occurred (InvalidParameterValue) 
                      when calling the CreateDBInstance operation: The parameter DBInstanceIdentifier 
                      is not a valid identifier. Identifiers must begin with a letter; must contain only ASCII 
                      letters, digits, and hyphens; and must not end with a hyphen or contain two 
                      consecutive hyphens..
     Started: 17:04:57.869420
    Duration: 1210.733 ms
     Changes:   
----------
          ID: set_in_pillar_rds_hostname
    Function: module.run
      Result: True
     Comment: boto_rds.describe: Success
     Started: 17:04:59.081403
    Duration: 80.193 ms
     Changes:   
              ----------
              boto_rds.describe:
                  ----------
                  exists:
                      True
                  message:
                      RDS instance dev_renderfarms does not exist.

Summary for local-minion
------------
Succeeded: 2 (changed=1)
Failed:    1
------------
Total states run:     3
Total run time:   3.028 s

Resources

Metadata

Metadata

Assignees

No one assigned

    Labels

    botoAWS wrapper modulesbugbroken, incorrect, or confusing behaviorneeds-triage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions