Sharing resources across terraform environments
Solution 1:
For your need, you can create another TF State which contains your shared resources only, Then import it as a variable or Data in your current State. You can do as follow
/Shared-resources <== shared stack to export SG
/main.tf
/export.tf
/Stack <== Import SG here
/main.tf
/vars/dev.tfvars
/vars/qa.tfvars
/vars/prod.tfvars
And your create 2 differents pipelines CICD to deploy "shared-resource" in his TF state, and the others in differents TF states.
Edit based on question changes:
First, it's not a good practice to have a unique VPC across many env, in your case you can have one VPC per environment, that solves the problem from the beginning :).
What you can do, is to extract the resources created in another state and leave the VPC untouched, that's mean extract the subnets and all network stuff in the shared-service state. Then import it in your VPC State as Data or variables from the other shared resources State