saltstack / saltstack/salt

Salt-cloud: Cannot specify provider and instance to stop

Open
#61,949 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug needs-triage Salt-Cloud
Dominant language
Python
Stars
15.7k
Forks
5.6k
Avg merge
2d 44m
Merged PRs (30d)
80

Description

Description of Issue

In the past, there was a decision made to not allow running the cloud.action "stop" for AWS ec2 with the options of provider as well as instance as seen in this issue:
https://github.com/saltstack/salt/issues/29602
My use case is that I have multiple AWS accounts that each need their own provider configuration that I need to specify in order to target which account my server is on. Oddly enough there are some cloud actions like "get_tags" that allows you to specify provider as well as instance_id which works perfectly fine but I cannot do things like stop, start, reboot, and many others because of this limitation.

I did notice that cloud.action takes "provider" and clouds.ec2.stop takes "name" so I've tried to pass provider to cloud.action and forward the "name" option but with no success. If there is a workaround like this, it would suffice.

Setup
/etc/salt/cloud:
providers:
  account1:
    id: use-instance-role-credentials
    key: use-instance-role-credentials
    driver: ec2
    role_arn: arn:aws:iam::123123123123:role/role-to assume
  account2:
    id: use-instance-role-credentials
    key: use-instance-role-credentials
    driver: ec2
    role_arn: arn:aws:iam::234234234234:role/role-to assume
Steps to Reproduce Issue

salt-run cloud.action func=stop instance=my-instance provider=my-provider

Versions Report

Salt Version:
Salt: 3004.1

Dependency Versions:
cffi: 1.9.1
cherrypy: Not Installed
dateutil: 2.8.2
docker-py: Not Installed
gitdb: 0.6.4
gitpython: 1.0.1
Jinja2: 2.11.1
libgit2: Not Installed
M2Crypto: 0.35.2
Mako: Not Installed
msgpack: 0.6.2
msgpack-pure: Not Installed
mysql-python: Not Installed
pycparser: 2.14
pycrypto: Not Installed
pycryptodome: 3.14.1
pygit2: Not Installed
Python: 3.6.8 (default, Nov 16 2020, 16:55:22)
python-gnupg: Not Installed
PyYAML: 5.4.1
PyZMQ: 17.0.0
smmap: 0.9.0
timelib: Not Installed
Tornado: 4.5.3
ZMQ: 4.1.4

Salt Extensions:
SSEAPE: 8.6.2.11

System Versions:
dist: centos 7 Core
locale: ANSI_X3.4-1968
machine: x86_64
release: 3.10.0-1062.12.1.el7.x86_64
system: Linux
version: CentOS Linux 7 Core

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the salt-run cloud.action func=stop instance=my-instance provider=my-provider reproduction and compare how cloud.action handles provider and how clouds.ec2.stop handles name. Use the existing get_tags behavior as a reference. Done means stop, start, reboot, and similar actions can target an instance through the specified AWS provider.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, python
Domain
cloud
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.