feat(modular): add TF snippets for enable GCP APIs #38
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
xref: https://sysdig.atlassian.net/browse/SSPROD-46145
This is a WIP for providing TF snippets to enable GCP APIs to customer so they don't have to do it manually.
All is working and the APIs are enabled properly for the GCP project and organization. The only thing that needs to be done is the scrapping of the folders within a GCP organization since the
google_projectsresource only provides the root projects within the organization and not the ones within folders, basically for a scenario like:The
google_projectsresource is only retrieving the projects:MyProject1andMyProject2. In order to change this I'll need to use another resource that grabs the folders and create a recursive functionality to scrape all the Org - working on this already.Update:
This was done via a
null_resourceresource in TF, basically this resource makes some API calls using gcloud and the context of the user machine to create a recursive function that scrapes the whole organization, after that ajson fileis saved to the local directory and then this is used to create the API enablement resources.TF does not let a
planorapplystep without knowing the data that it's going to be scraped so atargetapply needs to be done prior since thenull_resourceis only executed during anapply, the command will be:terraform init && terraform apply -target=null_resource.get_projects_from_folders --auto-approve && terraform apply --auto-approveWith this command, we make sure that the projects from folder are picked before starting the API enablement. It's also an easier way to avoid more work for the user.