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

Correct usage of 'folders' for 'google_folder_organization_policy' resource #963

Merged
merged 1 commit into from
Jan 17, 2018
Merged

Conversation

ewbankkit
Copy link
Contributor

The folders argument to the google_folder_organization_policy resource has to be the folder's resource name in the format folders/{folder_id}.
Correct the documentation.

@ewbankkit
Copy link
Contributor Author

What do you think to using canonicalFolderId to handle either just the folder ID or the full resource name?

@rosbo
Copy link
Contributor

rosbo commented Jan 16, 2018

I think we should definitely use the canonicalFolderId method here. Do you want to add it in this PR?

@ewbankkit
Copy link
Contributor Author

Yes, I can do that (and re-title the PR).

@ewbankkit
Copy link
Contributor Author

No need to change the PR title 😄.
Acceptance tests:

make testacc TEST=./google/ TESTARGS='-run=TestAccGoogleFolderOrganizationPolicy_'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./google/ -v -run=TestAccGoogleFolderOrganizationPolicy_ -timeout 120m
=== RUN   TestAccGoogleFolderOrganizationPolicy_boolean
=== RUN   TestAccGoogleFolderOrganizationPolicy_list_allowAll
=== RUN   TestAccGoogleFolderOrganizationPolicy_list_allowSome
=== RUN   TestAccGoogleFolderOrganizationPolicy_list_denySome
=== RUN   TestAccGoogleFolderOrganizationPolicy_list_update
--- PASS: TestAccGoogleFolderOrganizationPolicy_boolean (34.51s)
--- PASS: TestAccGoogleFolderOrganizationPolicy_list_update (16.31s)
--- PASS: TestAccGoogleFolderOrganizationPolicy_list_denySome (15.00s)
--- PASS: TestAccGoogleFolderOrganizationPolicy_list_allowSome (15.03s)
--- PASS: TestAccGoogleFolderOrganizationPolicy_list_allowAll (14.18s)
PASS
ok  	github.com/terraform-providers/terraform-provider-google/google	95.037s

@@ -38,7 +39,7 @@ func resourceGoogleFolderOrganizationPolicyCreate(d *schema.ResourceData, meta i

func resourceGoogleFolderOrganizationPolicyRead(d *schema.ResourceData, meta interface{}) error {
config := meta.(*Config)
folder := d.Get("folder").(string)
folder := canonicalFolderId(d.Get("folder").(string))
Copy link
Contributor

@rosbo rosbo Jan 16, 2018

Choose a reason for hiding this comment

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

You should also call this method at line 73 and 91 to ensure the create, delete and update method also work.

Can you also update one of the acceptance test to use the id only for the folder field:

resource "google_folder_organization_policy" "list" {
  folder     = "replace(${google_folder.orgpolicy.name}, 'folders/','')
  ...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@rosbo rosbo self-assigned this Jan 16, 2018
@ewbankkit
Copy link
Contributor Author

Rebased and squashed.

@ewbankkit
Copy link
Contributor Author

Travis CI go vet error - #968.

@ewbankkit
Copy link
Contributor Author

Rebased again after merge of #969.

@rosbo rosbo merged commit 34279a6 into hashicorp:master Jan 17, 2018
@ewbankkit ewbankkit deleted the patch-1 branch January 17, 2018 19:13
chrisst pushed a commit to chrisst/terraform-provider-google that referenced this pull request Nov 9, 2018
modular-magician pushed a commit to modular-magician/terraform-provider-google that referenced this pull request Sep 27, 2019
@ghost
Copy link

ghost commented Mar 30, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks!

@ghost ghost locked and limited conversation to collaborators Mar 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants