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

Add example profile 3 canary workload services projects around bigquery development #279

Closed
obriensystems opened this issue Aug 3, 2023 · 4 comments
Assignees
Labels
2024-pre-tef-v4 documentation Improvements or additions to documentation

Comments

@obriensystems
Copy link
Collaborator

obriensystems commented Aug 3, 2023

Update: investigate owner role on project or superfolder and folderIAMAdmin
Update: lay out prod/non-prod folder structure


follow document ai canary at https://github.com/GoogleCloudPlatform/pubsec-declarative-toolkit/blob/canary/solutions/document-processing/gcloud/deployment.sh#L88

https://cloud.google.com/bigquery/docs/access-control#bq-permissions
https://cloud.google.com/bigquery/docs/access-control#bigquery

training
https://www.cloudskillsboost.google/focuses/1145?parent=catalog
Screenshot 2023-08-03 at 13 02 04

Roles

gcloud projects add-iam-policy-binding $CC_PROJECT_ID  --member=sgroup:$EMAIL --role=roles/bigquery.admin --quiet > /dev/null 1>&1

Services

Big Query is usually enabled by default on a project - but the lz workflow has it unset - fixing

root_@cloudshell:~/lz-tls/_lz2/pbmm-on-gcp-onboarding (lz-tls)$ gcloud config set project tzpe-tlz-tlz-de
Updated property [core/project].
root_@cloudshell:~/lz-tls/_lz2/pbmm-on-gcp-onboarding (tzpe-tlz-tlz-de)$ gcloud services list | grep NAME
NAME: accesscontextmanager.googleapis.com
NAME: appengine.googleapis.com
NAME: artifactregistry.googleapis.com
NAME: cloudbilling.googleapis.com
NAME: cloudbuild.googleapis.com
NAME: cloudidentity.googleapis.com
NAME: cloudkms.googleapis.com
NAME: cloudresourcemanager.googleapis.com
NAME: compute.googleapis.com
NAME: containerregistry.googleapis.com
NAME: iam.googleapis.com
NAME: iamcredentials.googleapis.com
NAME: logging.googleapis.com
NAME: oslogin.googleapis.com
NAME: pubsub.googleapis.com
NAME: secretmanager.googleapis.com
NAME: serviceusage.googleapis.com
NAME: sourcerepo.googleapis.com
NAME: storage-api.googleapis.com

add

bigquery.googleapis.com
bigquerymigration.googleapis.com
bigquerystorage.googleapis.com

gcloud services enable bigquerymigration.googleapis.com
gcloud services enable bigquery.googleapis.com
gcloud services enable bigquerystorage.googleapis.com
@obriensystems
Copy link
Collaborator Author

obriensystems commented Aug 3, 2023

before - no access as expected
Screenshot 2023-08-03 at 12 11 27
Screenshot 2023-08-03 at 12 12 11

after


in prod

Step #3 - "tf plan": Terraform will perform the following actions:
Step #3 - "tf plan": 
Step #3 - "tf plan":   # module.prod-client-prj.google_project_service.project_services["bigquery.googleapis.com"] will be created
Step #3 - "tf plan":   + resource "google_project_service" "project_services" {
Step #3 - "tf plan":       + disable_dependent_services = true
Step #3 - "tf plan":       + disable_on_destroy         = true
Step #3 - "tf plan":       + id                         = (known after apply)
Step #3 - "tf plan":       + project                    = "tzpe-tlz-prd-client8"
Step #3 - "tf plan":       + service                    = "bigquery.googleapis.com"
Step #3 - "tf plan":     }
Step #3 - "tf plan": 
Step #3 - "tf plan":   # module.prod-client-prj.google_project_service.project_services["bigquerymigration.googleapis.com"] will be created
Step #3 - "tf plan":   + resource "google_project_service" "project_services" {
Step #3 - "tf plan":       + disable_dependent_services = true
Step #3 - "tf plan":       + disable_on_destroy         = true
Step #3 - "tf plan":       + id                         = (known after apply)
Step #3 - "tf plan":       + project                    = "tzpe-tlz-prd-client8"
Step #3 - "tf plan":       + service                    = "bigquerymigration.googleapis.com"
Step #3 - "tf plan":     }
Step #3 - "tf plan": 
Step #3 - "tf plan":   # module.prod-client-prj.google_project_service.project_services["bigquerystorage.googleapis.com"] will be created
Step #3 - "tf plan":   + resource "google_project_service" "project_services" {
Step #3 - "tf plan":       + disable_dependent_services = true
Step #3 - "tf plan":       + disable_on_destroy         = true
Step #3 - "tf plan":       + id                         = (known after apply)
Step #3 - "tf plan":       + project                    = "tzpe-tlz-prd-client8"
Step #3 - "tf plan":       + service                    = "bigquerystorage.googleapis.com"


and in common
Step #3 - "tf plan":   # module.iam-groups-role_opsadmin.module.organization_iam["group:opsadmin@terraform.landing.systems"].google_organization_iam_member.organization["roles/bigquery.admin"] will be created
Step #3 - "tf plan":   + resource "google_organization_iam_member" "organization" {
Step #3 - "tf plan":       + etag   = (known after apply)
Step #3 - "tf plan":       + id     = (known after apply)
Step #3 - "tf plan":       + member = "group:opsadmin@terraform.landing.systems"
Step #3 - "tf plan":       + org_id = "131880894992"
Step #3 - "tf plan":       + role   = "roles/bigquery.admin"
Step #3 - "tf plan":     }
Step #3 - "tf plan": 
Step #3 - "tf plan":   # module.iam-groups-role_read.module.organization_iam["group:read@terraform.landing.systems"].google_organization_iam_member.organization["roles/bigquery.admin"] will be created
Step #3 - "tf plan":   + resource "google_organization_iam_member" "organization" {
Step #3 - "tf plan":       + etag   = (known after apply)
Step #3 - "tf plan":       + id     = (known after apply)
Step #3 - "tf plan":       + member = "group:read@terraform.landing.systems"
Step #3 - "tf plan":       + org_id = "131880894992"
Step #3 - "tf plan":       + role   = "roles/bigquery.admin"
Step #3 - "tf plan":     }

Screenshot 2023-08-03 at 12 21 10 Screenshot 2023-08-03 at 12 21 40 Screenshot 2023-08-03 at 12 24 13 Screenshot 2023-08-03 at 12 29 21

obriensystems added a commit that referenced this issue Aug 3, 2023
fmichaelobrien added a commit that referenced this issue Aug 3, 2023
#279 - add bigquery service enablement and roles for canary project
@obriensystems
Copy link
Collaborator Author

obriensystems commented Aug 3, 2023

check limited access
Screenshot 2023-08-03 at 12 38 45
Screenshot 2023-08-03 at 12 39 33

getting iam admin via group role
Screenshot 2023-08-03 at 12 40 36

although only the terraform service account can modify group membership
Screenshot 2023-08-03 at 12 41 12

removing opsadmin group role

diff --git a/environments/common/iam-groups.auto.tfvars b/environments/common/iam-groups.auto.tfvars
index 019403f..dd6fdab 100644
--- a/environments/common/iam-groups.auto.tfvars
+++ b/environments/common/iam-groups.auto.tfvars
@@ -32,7 +32,7 @@ iam-group_opsadmin = {
   domain       = "terraform.landing.systems"
   #owners       = ["ro..ding.systems"]#, "tfsa..tlz-tlz-de.iam.gserviceaccount.com"] # var.service_accounts
   #managers     = ["roo..m.landing.systems"]
-  members      = ["root..stems", "devel...landing.systems"]
+  members      = ["roo..landing.systems"]

test results in #279

membership renewal in this case can be done without tearing down the group first - additive not authorative

Screenshot 2023-08-03 at 12 48 43
Step #3 - "tf plan": Terraform will perform the following actions:
Step #3 - "tf plan": 
Step #3 - "tf plan":   # module.group_opsadmin.google_cloud_identity_group_membership.members["developer@terraform.landing.systems"] will be destroyed
Step #3 - "tf plan":   - resource "google_cloud_identity_group_membership" "members" {
Step #3 - "tf plan":       - create_time = "2023-08-02T17:07:46.973190Z" -> null
Step #3 - "tf plan":       - group       = "groups/00gjdgxs0p378zo" -> null
Step #3 - "tf plan":       - id          = "groups/00gjdgxs0p378zo/memberships/118409452485276160936" -> null
Step #3 - "tf plan":       - name        = "groups/00gjdgxs0p378zo/memberships/118409452485276160936" -> null
Step #3 - "tf plan":       - type        = "USER" -> null
Step #3 - "tf plan":       - update_time = "2023-08-02T17:07:46.973190Z" -> null
Step #3 - "tf plan": 
Step #3 - "tf plan":       - member_key {
Step #3 - "tf plan":           - id = "developer@terraform.landing.systems" -> null
Step #3 - "tf plan":         }
Step #3 - "tf plan": 
Step #3 - "tf plan":       - preferred_member_key {
Step #3 - "tf plan":           - id = "developer@terraform.landing.systems" -> null
Step #3 - "tf plan":         }
Step #3 - "tf plan": 
Step #3 - "tf plan":       - roles {
Step #3 - "tf plan":           - name = "MEMBER" -> null
Step #3 - "tf plan":         }
Step #3 - "tf plan":     }

@obriensystems
Copy link
Collaborator Author

obriensystems commented Aug 3, 2023

verified lower iam permissions on dev user
Screenshot 2023-08-03 at 12 51 44
Screenshot 2023-08-03 at 12 52 43

big query ok on the org - reduce to the project
projects are limited
Screenshot 2023-08-03 at 12 54 01

@fmichaelobrien
Copy link
Contributor

20240406: Closing issue during retrofit/rebase of this TEF V1 based/modified repo to TEF V4 standards
This issue may participate in the LZ refactor after rebase
Query on all issues related to the older V1 version via the tag
2024-pre-tef-v4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2024-pre-tef-v4 documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants