Skip to content

used dynamic block to handle lack of device policy #31

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

Merged
merged 7 commits into from
Apr 6, 2020

Conversation

rajcheval
Copy link
Contributor

I am trying to fix this issue

#26

This issue prevents me from creating access_level if I am not creating a device policy.

@rajcheval
Copy link
Contributor Author

One of the checks failed. However, I am unable to view the reason for failure. when I press "Details" it asks me to log into GCP. I do log into my own GCP and I get this error:

There was an error while loading /cloud-build/builds/8242826b-f5eb-4b3e-aa6c-113348253201?project=2843445864.

You are missing at least one of the following required permissions:
Project

cloudbuild.builds.get

@bharathkkb
Copy link
Member

@rajcheval thanks for the contribution. There was a problem with the CI setup on our end that was fixed in #32. Could you rebase and try again?

@bharathkkb bharathkkb requested a review from morgante March 27, 2020 15:35
@bharathkkb
Copy link
Member

LGTM

@rajcheval
Copy link
Contributor Author

Is there any ETA on when this pull request will be reviewed?

Copy link
Contributor

@morgante morgante left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apologies for the delay. I think this is a good/necessary addition but we shouldn't need to require a new variable.

allowed_encryption_statuses = var.allowed_encryption_statuses
allowed_device_management_levels = var.allowed_device_management_levels
dynamic "device_policy" {
for_each = var.device_policy_enabled ? [{}] : []
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of introducing a new variable, I think we can compute this value.

Ex:

require_screen_lock || length(allowed_encryption_statuses) >= 0 || length(allowed_device_management_levels) >= 0 || minimum_version != "" || os_type != "OS_UNSPECIFIED

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made the change you had suggested. I had to make a few minor changes. I tested it locally. It seems to be working however some integration tests seem to be failing. I don't have any visibility into why the tests are failing. Let me know if I need to make any more changes. Thanks

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI you should be able to run the integration tests locally, but I'll take a look.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@morgante I went through the contribution guide to run the integration tests locally. It required using a service account with folder level permissions. It also has access. context manager policy admin permissions.

When I run
make docker_test_perpare

Error: error creating project ci-project-policy-test-0-dbc5 (ci-project-policy-test-0): googleapi: Error 409: Requested entity already exists, alreadyExists. If you received a 403 error, make sure you have the roles/resourcemanager.projectCreator permission

on .terraform/modules/project-vpc-service-controls-policy-0/modules/core_project_factory/main.tf line 126, in resource "google_project" "main":
126: resource "google_project" "main" {

I did give the service account "Project Creator" Project Creator Permissions before running the make command.
I will keep on debugging this error.

Thanks for your help

@rajcheval
Copy link
Contributor Author

I am not sure why the tests were failing yesterday and now they have passed. I am hoping that we will get this merged after review. Thanks

@morgante
Copy link
Contributor

morgante commented Apr 6, 2020

Looks like it was a temporary failure due to quota. Thank you for the contribution and patience!

@morgante morgante merged commit 17a9329 into terraform-google-modules:master Apr 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants