terraform-google-modules / terraform-example-foundation

Shows how the CFT modules can be composed to build a secure cloud foundation
https://cloud.google.com/architecture/security-foundations
Apache License 2.0
1.21k stars 708 forks source link

Cloudbuild triggers match unexpected branches #208

Closed rjerrems closed 4 years ago

rjerrems commented 4 years ago

Currently Cloud Build will trigger builds on branches that are not an exact match:

Screenshot from 2020-08-06 11-04-00

Thankfully, the wrapper scripts protects against anything being applied:

Finished Step #0 - "setup"
Starting Step #1 - "tf init"
Step #1 - "tf init": Already have image (with digest): gcr.io/cft-cloudbuild-9c00/terraform
Step #1 - "tf init": production doesn't match production2; skipping
Step #1 - "tf init": non-production doesn't match production2; skipping
Step #1 - "tf init": development doesn't match production2; skipping
Step #1 - "tf init": refs doesn't match production2; skipping
Step #1 - "tf init": objects doesn't match production2; skipping
Step #1 - "tf init": logs doesn't match production2; skipping
Step #1 - "tf init": info doesn't match production2; skipping
Step #1 - "tf init": hooks doesn't match production2; skipping
Step #1 - "tf init": branches doesn't match production2; skipping
Step #1 - "tf init": production doesn't match production2; skipping
Step #1 - "tf init": non-production doesn't match production2; skipping
Step #1 - "tf init": development doesn't match production2; skipping

Although we should update the bootstrap module, to ensure that no build is triggered at all. Related to this issue:

https://github.com/terraform-google-modules/terraform-google-bootstrap/issues/52

rjerrems commented 4 years ago

Fixed by https://github.com/terraform-google-modules/terraform-google-bootstrap/pull/53