Skip to content

Resolved aws_subnet_ids deprecation #23

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

azend
Copy link

@azend azend commented Oct 25, 2022

Note: changes are untested and should be reviewed before merge.

This PR updates the data resource that provides AWS subnet IDs. This change removes the deprecation warning caused by the old resource type.

Issue is described in #22 .

Copy link

@kvwake kvwake left a comment

Choose a reason for hiding this comment

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

--- a/README.md
+++ b/README.md
@@ -102,7 +102,7 @@ No modules.
 | [aws_partition.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/partition) | data source |
 | [aws_region.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/region) | data source |
 | [aws_route_table.selected](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/route_table) | data source |
-| [aws_subnet_ids.selected](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/subnet_ids) | data source |
+| [aws_subnets.selected](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/subnets) | data source |
 | [aws_vpc.selected](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/vpc) | data source |

@azend azend requested a review from kvwake November 17, 2022 20:31
@azend
Copy link
Author

azend commented Dec 19, 2022

Just a reminder that I can’t merge these changes because I’m not a project member.

@chrismazanec
Copy link

@kvwake @azend have you tested the code? I have introduced this fix here; https://github.com/bridgecrewio/terraform-aws-session-manager/pull/20/files#diff-d27b6bbb73d8ee24ac0b6cae34cdddcde2c220a0ed46e41cfd5b36e4a61b41abR3 long time ago, I believe that should read data.aws_subnets.selected[0].ids to support count in aws_subnets resource. your code won't work since

Because data.aws_subnets.selected has "count" set, its attributes must be
│ accessed on specific instances.
│
│ For example, to correlate with indices of a referring resource, use:
│     data.aws_subnets.selected[count.index]
╵

@azend
Copy link
Author

azend commented Dec 23, 2022

I didn't until now. It seemed like no one was maintaining this repo so I got it working for what I needed it for then lost interest. You're definitely right about the resource index being in the wrong spot. I've fixed it in my fork, validated syntax with terraform validate and planned it against my deployed environment. It results in 0 changes save the no longer present deprecation warning. Cheers.

@cfenogli0
Copy link

Can someone merge this change? I am attempting to use the module with a later version of AWS and am completely blocked

@azend
Copy link
Author

azend commented Nov 20, 2023

I can't. We need a repo maintainer to merge.

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.

4 participants