Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] terraform roster doesn't work anymore with new terraform state file format #60915

Closed
viq opened this issue Sep 21, 2021 · 1 comment
Closed
Assignees
Labels
Bug broken, incorrect, or confusing behavior

Comments

@viq
Copy link
Contributor

viq commented Sep 21, 2021

Description
https://github.com/saltstack/salt/blob/master/salt/roster/terraform.py#L126 opens directly terraform state file for reading. The format of the file changed, and a list modules doesn't exist anymore, producing only

$ salt-ssh '*' test.ping
[ERROR   ] Malformed tfstate file. No modules found
[ERROR   ] No matching targets found in roster.

Setup
Very basic setup with pipenv per https://docs.saltproject.io/en/latest/ref/roster/all/salt.roster.terraform.html:

$ cat Saltfile
salt-ssh:
  config_dir: etc/salt
  max_procs: 30
  wipe_ssh: True
$ cat Pipfile
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true

[dev-packages]

[packages]
salt-ssh = "*"
present = "*"

[requires]
python_version = "3.9"

[pipenv]
allow_prereleases = true
$ cat etc/salt/master
root_dir: .
file_roots:
  base:
    - srv/salt
pillar_roots:
  base:
    - srv/pillar
roster: terraform

Machine created on OpenStack via terraform, with

resource "openstack_compute_instance_v2" "salt" {
(...)
}

resource "salt_host" "salt" {
  salt_id = "salt"
  host = "${openstack_compute_instance_v2.salt.access_ip_v4}"
  user = "debian"
  passwd = "hopefully_this_isnt_used"
  sudo = true
}
$ terraform version
Terraform v1.0.7
on linux_amd64
+ provider registry.terraform.io/dmacvicar/salt v0.0.2
+ provider registry.terraform.io/terraform-provider-openstack/openstack v1.43.0

Steps to Reproduce the behavior
Follow https://docs.saltproject.io/en/latest/ref/roster/all/salt.roster.terraform.html using recent terraform version, try to use salt-ssh with it.

Expected behavior
Roster working.

Versions Report

salt --versions-report (Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)
$ salt-ssh --versions-report
Salt Version:
          Salt: 3003.3
 
Dependency Versions:
          cffi: Not Installed
      cherrypy: Not Installed
      dateutil: Not Installed
     docker-py: Not Installed
         gitdb: Not Installed
     gitpython: Not Installed
        Jinja2: 3.0.1
       libgit2: Not Installed
      M2Crypto: Not Installed
          Mako: Not Installed
       msgpack: 1.0.2
  msgpack-pure: Not Installed
  mysql-python: Not Installed
     pycparser: Not Installed
      pycrypto: Not Installed
  pycryptodome: 3.10.1
        pygit2: Not Installed
        Python: 3.9.7 (default, Aug 30 2021, 00:00:00)
  python-gnupg: Not Installed
        PyYAML: 5.4.1
         PyZMQ: 22.3.0
         smmap: Not Installed
       timelib: Not Installed
       Tornado: 4.5.3
           ZMQ: 4.3.4
 
System Versions:
          dist: fedora 33 
        locale: utf-8
       machine: x86_64
       release: 5.13.13-1.fc25.qubes.x86_64
        system: Linux
       version: Fedora 33 

@viq viq added Bug broken, incorrect, or confusing behavior needs-triage labels Sep 21, 2021
@garethgreenaway garethgreenaway assigned Ch3LL and unassigned xeacott Oct 19, 2021
@garethgreenaway garethgreenaway assigned MKLeb and unassigned Ch3LL Mar 8, 2022
@MKLeb
Copy link
Contributor

MKLeb commented Dec 7, 2022

Closing because #61311 should fix it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug broken, incorrect, or confusing behavior
Projects
None yet
Development

No branches or pull requests

5 participants