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

Refactor requester.tf to use aws_route_tables data source #78

Closed
wants to merge 9 commits into from

Conversation

vquie
Copy link

@vquie vquie commented Sep 7, 2023

what

  • Replaced the "aws_route_table" data source with "aws_route_tables" for better handling of multiple route tables in the VPC.
  • Added a filter to the "aws_route_tables" data source to only include route tables associated with the subnets in the VPC.
  • Updated dependencies in the "aws_route" resource to reflect the change in data source.

why

All my VPCs with more then one subnet raised this error.

Error: query returned no results. Please change your search criteria and try again

  with module.vpc_vpn_vpc_peering.data.aws_route_table.requester[5],
  on .terraform/modules/vpc_vpn_vpc_peering/requester.tf line 124, in data "aws_route_table" "requester":
 124: data "aws_route_table" "requester" {

references

https://sweetops.slack.com/archives/CB6GHNLG0/p1694006033839549

@vquie vquie requested review from a team as code owners September 7, 2023 16:02
@vquie vquie force-pushed the update-requester-route-tables branch from 316b624 to b9324e6 Compare September 7, 2023 16:29
@max-lobur
Copy link
Contributor

/terratest

@max-lobur
Copy link
Contributor

Please run make precommit/terraform and commit the changes, this should fix all the linters

@max-lobur
Copy link
Contributor

I've merged the baseline fixes, and don’t know the fix for the current error yet. It’s also in main branch
https://github.com/cloudposse/actions/actions/runs/6216155331/job/16869736066
I thought this PR was to address it but no, it's different. Will recheck this week

@vquie
Copy link
Author

vquie commented Sep 18, 2023

Please run make precommit/terraform and commit the changes, this should fix all the linters

Done. Thanks.

@tfendt-belong-gg
Copy link

I am getting this same error, can this get merged?

@vquie vquie force-pushed the update-requester-route-tables branch from 0804651 to 80efa84 Compare January 19, 2024 07:39
@aknysh
Copy link
Member

aknysh commented Jan 19, 2024

@vquie thanks for the PR.
Please run the following commands and commit the changes:

make init
make github/init
make readme

See https://github.com/cloudposse/terraform-aws-vpc-peering-multi-account/actions/runs/7580845569/job/20665790563?pr=78

Copy link
Member

@aknysh aknysh left a comment

Choose a reason for hiding this comment

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

please see comments

@vquie
Copy link
Author

vquie commented Jan 23, 2024

@aknysh

Unfortunately this failed on my machine.

❯ make readme
* Installing packages master...
Cloning into '/Users/homefolder/git/github/terraform-aws-vpc-peering-multi-account/build-harness/vendor/packages'...
remote: Enumerating objects: 942, done.
remote: Counting objects: 100% (942/942), done.
remote: Compressing objects: 100% (451/451), done.
remote: Total 942 (delta 335), reused 627 (delta 251), pack-reused 0
Receiving objects: 100% (942/942), 11.23 MiB | 1.36 MiB/s, done.
Resolving deltas: 100% (335/335), done.
* Installing gomplate to /Users/homefolder/git/github/terraform-aws-vpc-peering-multi-account/build-harness/vendor
mkdir -p -m a+rX /Users/homefolder/git/github/terraform-aws-vpc-peering-multi-account/build-harness/vendor
curl --retry 3 --retry-delay 5 --fail -sSL -o /Users/homefolder/git/github/terraform-aws-vpc-peering-multi-account/build-harness/vendor/gomplate https://github.com/hairyhenderson/gomplate/releases/download/v3.11.7/gomplate_darwin-arm64 && chmod +x /Users/homefolder/git/github/terraform-aws-vpc-peering-multi-account/build-harness/vendor/gomplate
* Installing terraform-docs to /Users/homefolder/git/github/terraform-aws-vpc-peering-multi-account/build-harness/vendor
mkdir -p -m a+rX /Users/homefolder/git/github/terraform-aws-vpc-peering-multi-account/build-harness/vendor
[ -n "/tmp" ] && [ -n "terraform-docs" ] && rm -rf "/tmp/terraform-docs"
mkdir -p /tmp/terraform-docs
curl --retry 3 --retry-delay 5 --fail -sSL -o - https://github.com/segmentio/terraform-docs/releases/download/v0.17.0/terraform-docs-v0.17.0-darwin-arm64.tar.gz | tar -zx -C /tmp/terraform-docs
find /tmp/terraform-docs -type f -name terraform-docs | xargs -I {} cp -f {} /Users/homefolder/git/github/terraform-aws-vpc-peering-multi-account/build-harness/vendor/terraform-docs
chmod +x /Users/homefolder/git/github/terraform-aws-vpc-peering-multi-account/build-harness/vendor/terraform-docs
[ -n "/tmp" ] && [ -n "terraform-docs" ] && rm -rf "/tmp/terraform-docs"
make: gomplate: No such file or directory
make: *** [readme/build] Error 1

Any ideas?

@aknysh
Copy link
Member

aknysh commented Jan 25, 2024

@aknysh

Unfortunately this failed on my machine.

❯ make readme
* Installing packages master...
Cloning into '/Users/homefolder/git/github/terraform-aws-vpc-peering-multi-account/build-harness/vendor/packages'...
remote: Enumerating objects: 942, done.
remote: Counting objects: 100% (942/942), done.
remote: Compressing objects: 100% (451/451), done.
remote: Total 942 (delta 335), reused 627 (delta 251), pack-reused 0
Receiving objects: 100% (942/942), 11.23 MiB | 1.36 MiB/s, done.
Resolving deltas: 100% (335/335), done.
* Installing gomplate to /Users/homefolder/git/github/terraform-aws-vpc-peering-multi-account/build-harness/vendor
mkdir -p -m a+rX /Users/homefolder/git/github/terraform-aws-vpc-peering-multi-account/build-harness/vendor
curl --retry 3 --retry-delay 5 --fail -sSL -o /Users/homefolder/git/github/terraform-aws-vpc-peering-multi-account/build-harness/vendor/gomplate https://github.com/hairyhenderson/gomplate/releases/download/v3.11.7/gomplate_darwin-arm64 && chmod +x /Users/homefolder/git/github/terraform-aws-vpc-peering-multi-account/build-harness/vendor/gomplate
* Installing terraform-docs to /Users/homefolder/git/github/terraform-aws-vpc-peering-multi-account/build-harness/vendor
mkdir -p -m a+rX /Users/homefolder/git/github/terraform-aws-vpc-peering-multi-account/build-harness/vendor
[ -n "/tmp" ] && [ -n "terraform-docs" ] && rm -rf "/tmp/terraform-docs"
mkdir -p /tmp/terraform-docs
curl --retry 3 --retry-delay 5 --fail -sSL -o - https://github.com/segmentio/terraform-docs/releases/download/v0.17.0/terraform-docs-v0.17.0-darwin-arm64.tar.gz | tar -zx -C /tmp/terraform-docs
find /tmp/terraform-docs -type f -name terraform-docs | xargs -I {} cp -f {} /Users/homefolder/git/github/terraform-aws-vpc-peering-multi-account/build-harness/vendor/terraform-docs
chmod +x /Users/homefolder/git/github/terraform-aws-vpc-peering-multi-account/build-harness/vendor/terraform-docs
[ -n "/tmp" ] && [ -n "terraform-docs" ] && rm -rf "/tmp/terraform-docs"
make: gomplate: No such file or directory
make: *** [readme/build] Error 1

Any ideas?

@vquie please run brew install gomplate to install gomplate

https://docs.gomplate.ca/installing/

and then again:

make init
make github/init
make readme

@vquie
Copy link
Author

vquie commented Jan 25, 2024

@aknysh, thanks. I should've figured that out myself. 🤦

The command went through successfully and the new changes are pushed.

@hans-d hans-d added wip Work in Progress: Not ready for final review or merge and removed wip Work in Progress: Not ready for final review or merge labels Mar 2, 2024
@hans-d
Copy link

hans-d commented Mar 2, 2024

/terratest

@vquie vquie force-pushed the update-requester-route-tables branch from 9e60837 to 5e55a1a Compare March 2, 2024 22:18
@hans-d
Copy link

hans-d commented Mar 2, 2024

/terratest

Copy link

mergify bot commented Apr 1, 2024

💥 This pull request now has conflicts. Could you fix it @vquie? 🙏

@mergify mergify bot added conflict This PR has conflicts triage Needs triage labels Apr 1, 2024
- Replaced the "aws_route_table" data source with "aws_route_tables" for better
  handling of multiple route tables in the VPC.
- Added a filter to the "aws_route_tables" data source to only include route
  tables associated with the subnets in the VPC.
- Updated dependencies in the "aws_route" resource to reflect the change in data
  source.
- Renamed `default_rts` to `accepter_default_rts` in accepter.tf and updated references
- Added `requester_default_rts` in requester.tf to handle cases with more subnets than route tables
- Updated `requester_aws_rt_map` to use `requester_default_rt_id` if specific route table id is not found for a subnet
- Adjusted the alignment of the variables in the locals block for better readability.
- No functional changes were made.

Signed-off-by: Vitali Quiering <vitali@quiering.com>
vquie and others added 6 commits April 2, 2024 18:23
- Removed `aws_route_table.requester` data source
- Renamed `aws_route_tables.default_rts` to `aws_route_tables.accepter_default_rts`
- Added `aws_route_tables.requester` and `aws_route_tables.requester_default_rts` data sources

Signed-off-by: Vitali Quiering <vitali@quiering.com>
- Adjusted the alignment of the assignment operators for better readability.
- No changes in the logic or functionality of the code.

Signed-off-by: Vitali Quiering <vitali@quiering.com>
- Removed redundant information and unnecessary sections
- Reorganized content for better flow and readability
- Updated formatting to improve visual presentation
- Fixed broken links and incorrect data source references
- Added a section for contributors and contribution guidelines
- Updated the About section with more detailed information about Cloud Posse
- Removed unnecessary sharing links and badges
- Updated copyright information
- Updated the method of retrieving route table IDs in both accepter.tf and requester.tf files to use a more efficient list comprehension.
- Removed unnecessary data blocks for aws_caller_identity and aws_region in requester.tf as they were not being used.

Signed-off-by: Vitali Quiering <vitali@quiering.com>
- Refactor README to improve readability and update links
- Remove unused data sources from terraform documentation
- Update contributing guidelines and community information
- Add details about commercial support and licensing
- Remove unnecessary markdownlint comments
@vquie vquie force-pushed the update-requester-route-tables branch from 5e55a1a to 60147e7 Compare April 2, 2024 16:27
@mergify mergify bot removed the conflict This PR has conflicts label Apr 2, 2024
Copy link

mergify bot commented May 6, 2024

💥 This pull request now has conflicts. Could you fix it @vquie? 🙏

@mergify mergify bot added the conflict This PR has conflicts label May 6, 2024
@mergify mergify bot closed this May 6, 2024
Copy link

mergify bot commented May 6, 2024

This PR was closed due to inactivity and merge conflicts. 😭
Please resolve the conflicts and reopen if necessary.

@mergify mergify bot removed conflict This PR has conflicts triage Needs triage labels May 6, 2024
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.

None yet

5 participants