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

aws_subnets tags resources returns a nested list #950

Open
edmeister opened this issue Oct 5, 2022 · 0 comments
Open

aws_subnets tags resources returns a nested list #950

edmeister opened this issue Oct 5, 2022 · 0 comments

Comments

@edmeister
Copy link

Describe the problem

I try to test if certain tags have been set on my subnets, but unfortunately, the tags property returns a nested list, making it rather impossible to test if a certain tag is in it.

Test code:

vpc_private_subnet_ids = attribute('vpc_private_subnet_ids', description: 'private subnet ids')

control 'vpc' do
  vpc_private_subnet_ids.each do |subnet_id|
    describe aws_subnets.where(subnet_id: subnet_id) do
      its('tags') { should include({key: 'kubernetes.io/cluster/test-cluster1', value: 'shared'}) }
    end
  end
end

(Redacted) output of the test:

 ×  aws_subnets with subnet_id == "subnet-0****6" tags is expected to include {:key => "kubernetes.io/cluster/test-cluster1", :value => "shared"}
     expected [[{:key => "Ext_access", :value => "true"}, {:key => "Name", :value => "********-1...hared"}, {:key => "Public", :value => "false"}, {:key => "kubernetes.io/role/internal-elb", :value => "1"}]] to include {:key => "kubernetes.io/cluster/test-cluster1", :value => "shared"}

Possible Solution

The tags property should be a simple list containing the key-value pairs. This will allow us to test resources with multiple tags.

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

No branches or pull requests

1 participant