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

fix(terraform): fix reference extraction from TupleConsExpr #1510

Merged
merged 1 commit into from
Jan 10, 2024

Conversation

nikpivkin
Copy link
Collaborator

@nikpivkin nikpivkin commented Dec 22, 2023

The AllReferences method of the ssh_keys attribute returns only 1 reference to a block, but must return 2. The attribute expression is TupleConsExpr, which represents a list or set of expressions that can reference another block. This PR fixes this and extracts references from each TupleConsExpr expression.

Sample config:

data "digitalocean_ssh_key" "first" {
  name = "mikhalych_deploy_key"
}

data "digitalocean_ssh_key" "second" {
  name = "d.lukshto-deploy-key"
}

resource "digitalocean_droplet" "this" {
  image              = "ubuntu-20-04-x64"
  name               = "test"
  region             = var.region
  size               = "g-2vcpu-8gb"
  private_networking = true
  ssh_keys = [
    data.digitalocean_ssh_key.first.id,
    data.digitalocean_ssh_key.second.id,
  ]
}

@nikpivkin nikpivkin requested a review from simar7 as a code owner December 22, 2023 10:08
@simar7 simar7 merged commit 72340d1 into aquasecurity:master Jan 10, 2024
5 checks passed
@nikpivkin nikpivkin deleted the ref-cons branch January 11, 2024 07:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants