Skip to content

Conversation

@flybd5
Copy link

@flybd5 flybd5 commented Sep 4, 2018

Modified code to add a when statement that will not add a subnet to the returned list if it is already there.

- "{{ aws_vpc_rt_subnet_by_cidr }}"
- "{{ aws_vpc_rt_subnet_by_filter }}"
- "{{ aws_vpc_rt_subnet_by_id }}"
when: not ([item] in aws_vpc_route_table_subnets)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd say we should assert here and error out in order to make the user aware of the fact that two duplicate subnets have been found.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that really an error? Could we not in theory have two subnets with duplicated facts but in different fields? If it is, then I would agree, but it sounds to me that it might not be in all cases.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In particular, maybe two subnets with the same tags?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is search by filter. So you could for example only specify tag:department=DevOps which would return a lot of subnets which all have this tag attached.

Copy link
Author

@flybd5 flybd5 Sep 5, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, then the question is whether or not we would have some sort of logic to detect when filters are given which return too many subnets? Perhaps a ticket should be opened to deal with this later on? For now the change I made will keep duplicate subnets from being added to the route table subnet list.

Copy link
Member

@cytopia cytopia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what do u think?

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.

3 participants