-
Notifications
You must be signed in to change notification settings - Fork 15
WIP: Implement looker_project and more #15
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
base: master
Are you sure you want to change the base?
WIP: Implement looker_project and more #15
Conversation
pkg/looker/resource_connection.go
Outdated
@@ -326,7 +326,7 @@ func expandWriteDBConnection(d *schema.ResourceData) (*apiclient.WriteDBConnecti | |||
|
|||
// optional values | |||
if v, ok := d.GetOk("port"); ok { | |||
port := int64(v.(int)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The latest version of the looker sdk has this field noted as string.
@lukas-at-harren Thank you for your contribution! I'll take a look tonight! |
I will check test failures this week. |
@lukas-at-harren Hi, lukas! What's the status of this and related PR? |
@hirosassa hi, sorry for the massive delay in everything. But the people over at the Looker-SDK seem to have no time/attention for the PR I posted there. I bumped them in a comment, and hope to get things moving. From my side, this is still active, and I hope that this contribution makes it through. |
@hirosassa there has been some movement upstream, my change/fix was not merged but there is now looker-open-source/sdk-codegen#1021 that should close this bug. |
@lukas-at-harren Hi! Could you update this PR? sdk-codegen is updated! |
…oject_git_repository
82f2079
to
40fa566
Compare
@hirosassa hi, I finally got to rebase the PR onto your master. It seems to work fine (on our end). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution! I added a few comments. Please check!
} | ||
return diag.FromErr(err) | ||
} | ||
d.Set("git_deploy_key", gitDeployKey) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should check err
like below:
d.Set("git_deploy_key", gitDeployKey) | |
if err = d.Set("git_deploy_key", gitDeployKey); err != nil { | |
return diag.FromErr(err) | |
} |
if err != nil { | ||
return diag.FromErr(err) | ||
} | ||
d.Set("git_deploy_key", gitDeployKey) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
d.Set("git_deploy_key", gitDeployKey) | |
if err = d.Set("git_deploy_key", gitDeployKey); err != nil { | |
return diag.FromErr(err) | |
} |
if err != nil { | ||
return diag.FromErr(err) | ||
} | ||
d.Set("git_service_name", project.GitServiceName) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
d.Set("git_service_name", project.GitServiceName) | |
if err = d.Set("git_service_name", project.GitServiceName); err != nil { | |
return diag.FromErr(err) | |
} |
return diag.FromErr(err) | ||
} | ||
d.Set("git_service_name", project.GitServiceName) | ||
d.Set("git_remote_url", project.GitRemoteUrl) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
d.Set("git_remote_url", project.GitRemoteUrl) | |
if err = d.Set("git_remote_url", project.GitRemoteUrl); err != nil { | |
return diag.FromErr(err) | |
} |
writeProject := apiclient.WriteProject{ | ||
Name: &projectName, | ||
} | ||
project, err := client.CreateProject(writeProject, nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cloud you add [DEBUG]
log before api call in Create, Read, Update, and Delete?
For example,
https://github.com/hirosassa/terraform-provider-looker/blob/master/pkg/looker/resource_user_attribute.go#L75
@lukas-at-harren Hi, what's the status? |
Hi guys, just to let you know that a new provider has been released with all the functionalities, project creation etc. It's open source. Feel free to use it and contribute |
@Nabil-Lahssini can you add support for |
@vmichel95 Hi, thank you for your response, support for |
* upstream/master: Allow updating connection certificate (hirosassa#40) Fix hidden value domain whitelist (hirosassa#38) Update release.yml Update workflow (hirosassa#37) Fix user attribute user value delete (hirosassa#36) Support HiddenValueDomainWhitelist (hirosassa#35) Support IsDisabled (hirosassa#34)
I added the following resources:
Those allow to setup Looker projects and git configuration.
In order for them to work properly, I had to fix the looker SDK (See also: looker-open-source/sdk-codegen#912).
Please only merge after:
––
Of course adding projects via Terraform is not without issues.
Besides the bug in the golang looker API client, there are some issues with the Looker API itself.
One is, that the API does not support deleting projects.
=> I solved this by issuing a warning to the user of the resource.
Another is, that the API client session must be forced into "dev"-mode in order to create projects.
=> That I am currently still testing.
=> One suggestion I have, if this turns out to be a major hassle, is to allow for a "workspace_id" configuration at the provider level. That way, the user could configure two looker providers, one per workspace_id (production, dev) and this problem would also be solved.
Adding a git-repository to a Looker project is a major hassle.
=> I attempt to solve this by having separate resources dealing with the git deploy key and the git repository configuration of a project. This way, a user of the resources can create a proper dependency graph creating a deploy key and assigning the deploy key to a Github project via the terraform github provider.