-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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: updated subnets to use for_each rather then count #73
fix: updated subnets to use for_each rather then count #73
Conversation
Hmm outputs have changed a bit, I'm going to see if I can create some tests for them |
@skenmy @morgante this PR should be ready for a review! It will result in a pretty large state change for the end use, so some amount of state surgery will be required , something like ` terraform state mv module.example.google_compute_subnetwork.subnetwork[0] module.example.google_compute_subnetwork.subnetwork[0] module.example.google_compute_subnetwork.subnetwork[0] module.example.google_compute_subnetwork.subnetwork["us-east1/subnetwork1"] |
Please let me know if there are other requested changes, or concerns I can address in this PR 😃 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with a couple comments on syntax.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution. Just want to note that we need to write a migration guide before merging/releasing.
Is adding that to the README ok, or would you prefer it somewhere else? |
Preferable a separate doc + script, linked from changelog, following the GKE example. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
0028cd4
to
e413154
Compare
I rebased this branch against master, as well as attempted to add a migration doc, and a small helper script. I'm now fixing a bunch of small linting errors, after that I think this will be good to go |
ff8f440
to
86d2dad
Compare
Rebased against master this morning so that this PR wouldn't have merge conflicts |
Whoops, missed these
This reverts commit 1dd8c4e.
This warning was being thrown by the linter ``` Checking file headers 1 files have incorrect boilerplate headers: test/integration/secondary_ranges/controls/inspec_attributes.rb ```
Making sure `depends_on = [google_compute_subnetwork.subnetwork]` is correctly added in after a rebase as per terraform-google-modules#81
86d2dad
to
aee0cc0
Compare
This reverts commit aee0cc0.
@morgante I rebased this again this morning so as not to conflict with master. I don't mean to nag, could I get some feedback on this PR? Is there anything else you folks would like to see? I think I have addressed the outstanding feedback, if there is more I would be happy to address that as well. Is this blocked for some reason? This bug has help me up from using this module and I'd really like to use it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tfhartmann Apologies for sitting on this so long. Code is looking great, but unfortunately the migration script isn't working for me:
$ MODULE_NAME=vpc ../../../modules/network/scripts/migrate.sh
Error: Invalid character
on line 2:
(source code not available)
Expected an attribute access or an index operator.
Dry-run looks incorrect too:
MODULE_NAME="vpc" ../../../modules/network/scripts/migrate.sh --dry-run
terraform state mv module.vpc-nonprod.module.vpc.data.google_compute_subnetwork.created_subnets[0] module.vpc-nonprod.module.vpc
module.vpc-prod.module.vpc.google_compute_subnetwork.subnetwork[\"us-central1/clf-shared-net-gke\"]
terraform state mv module.vpc-nonprod.module.vpc.google_compute_network.network module.vpc-nonprod.module.vpc
module.vpc-prod.module.vpc.google_compute_subnetwork.subnetwork[\"clf-shared-net-nonprod\"]
terraform state mv module.vpc-nonprod.module.vpc.google_compute_shared_vpc_host_project.shared_vpc_host[0] module.vpc-nonprod.module.vpc
module.vpc-prod.module.vpc.google_compute_subnetwork.subnetwork[\"clf-shared-net-nonprod\"]
terraform state mv module.vpc-nonprod.module.vpc.google_compute_subnetwork.subnetwork[0] module.vpc-nonprod.module.vpc
module.vpc-prod.module.vpc.google_compute_subnetwork.subnetwork[\"us-central1/clf-shared-net-gke\"]
terraform state mv module.vpc-prod.module.vpc.google_compute_subnetwork.subnetwork[0] module.vpc-nonprod.module.vpc
Would you mind taking another look at the migration script? I'd suggest simply reusing one of the existing migration scripts for consistency/reliability.
Also: could we place the migration script in helpers/
? (Not scripts/
.)
The migrate script will now migrate all the modules
To be honest, when I looked at the python script, it looked like a bit more overhead then is actually needed. I would have to remove the bits that update the manifest files, and the parts that manipulate state looked like it was making calls to the shell. I think that rather than use python to invoke shell commands, it is simper to use a bash script in this instance.
I moved the script to |
@tfhartmann Unfortunately I'm still having issues using the migration script, but I'm going to take a stab at fixing it myself. |
I also updated the outputs as well. This will be large state change however and probably needs to be a major release
This should address issue #70 - however I didn't update the routes resource which will likely have a similar problem