Closed ameier38 closed 4 years ago
@ameier38 happy for you to prep the PR for the upgrade :+1:
Thanks, should have something in the next day or so.
Would like to first update the OpenFaaS api so that all of the function information is returned from /system/function
Any updates on this?
Well for anyone else asking, got around this provider by enabling openfaas operators. You can then deploy regular k8s yml for functions and leverage terraform-provider-kubernetes-yaml
I'd be more than happy to take a look at this issue and see if I can get it closed off?
@mkimberley go for it. Should be straight forward ive done a couple following https://www.terraform.io/docs/extend/terraform-0.12-compatibility.html
Much appreciated
Terraform by HashiCorpCompatibility with Terraform 0.12 requires some changes to existing provider codebases.
I've started working on this one, Terraform's upgrade was simple enough, but I'm getting build issues as the OpenFaas project code base has moved on a little, changing the way auth and function calls are handled. Hopefully I'll get this cracked and get a PR submitted. Very much new to all of this! :)
You might want to ask for help on Slack with that. It would be good to have this up to date 👍
@ewilde are you still maintaining this project?
@alexellis yes I’m still maintaining this project
@ewilde - I wonder if you can help, I have done the majority of the changes now to support terraform 0.12 and openfaas 0.18.0 but I'm struggling with authentication issues (I'm very new to OpenFaas, and not overly familiar with how it handles auth)
I've pushed my recent changes: https://github.com/mkimberley/terraform-provider-openfaas
Go tests fail with the following:
2020/02/25 11:15:44 [DEBUG] returning provider schema
=== RUN TestAccDataSourceOpenFaaSFunction_basic
--- FAIL: TestAccDataSourceOpenFaaSFunction_basic (0.05s)
testing.go:568: Step 0 error: errors during apply:
Error: error deploying function testaccopenfaasfunction-basic-a7spwfz6m7 status code 401 reason unauthorized access, run "faas-cli login" to setup authentication for this server
on /tmp/tf-test953499142/main.tf line 1:
(source code not available)
=== RUN TestAccOpenFaaSFunction_importBasic
--- FAIL: TestAccOpenFaaSFunction_importBasic (0.01s)
testing.go:568: Step 0 error: errors during apply:
Error: error deploying function testaccopenfaasfunction-basic-w2h9ls23cv status code 401 reason unauthorized access, run "faas-cli login" to setup authentication for this server
on /tmp/tf-test117854504/main.tf line 1:
(source code not available)
=== RUN TestProvider
--- PASS: TestProvider (0.00s)
=== RUN TestAccResourceOpenFaaSFunction_basic
--- FAIL: TestAccResourceOpenFaaSFunction_basic (0.02s)
testing.go:568: Step 0 error: errors during apply:
Error: error deploying function testaccopenfaasfunction-basic-8x4438v2xi status code 401 reason unauthorized access, run "faas-cli login" to setup authentication for this server
on /tmp/tf-test288393370/main.tf line 1:
(source code not available)
FAIL
exit status 1
FAIL github.com/mkimberley/terraform-provider-openfaas/openfaas 0.099s
And the way I'm approaching the provider authentication presently (which is what I think is wrong) is:
func providerConfigure(d *schema.ResourceData) (interface{}, error) {
log.Printf("[DEBUG] configuring provider")
config := Config{
GatewayURI: d.Get("uri").(string),
TLSInsecure: d.Get("tls_insecure").(bool),
GatewayUserName: d.Get("user_name").(string),
GatewayPassword: d.Get("password").(string),
ProxyNameSpace: d.Get("namespace").(string),
}
if config.GatewayUserName != "" && config.GatewayPassword != "" {
token := openfaas_config.EncodeAuth(config.GatewayUserName, config.GatewayPassword)
openfaas_config.UpdateAuthConfig(config.GatewayURI, token, "basic")
}
return config, nil
}
Just wondering if you can point me in the correct direction to work from next
Cheers! Almost there!
GitHubTerraform OpenFaaS provider . Contribute to mkimberley/terraform-provider-openfaas development by creating an account on GitHub.
@mkimberley Thank you I’ll take a look
@mkimberley i've added support for terraform 0.12 with this release https://github.com/ewilde/terraform-provider-openfaas/releases/tag/v0.3.0
I would really appreciate if you could verify it works for your use case. I've tested it with the examples and integration tests and it works fine
GitHubTerraform OpenFaaS provider . Contribute to ewilde/terraform-provider-openfaas development by creating an account on GitHub.
Thanks a bunch, will give it a try and report any issues
Tested and working as expected, Thanks @ewilde !
Could you please add support for Terraform 0.12?
Ref: https://www.terraform.io/docs/extend/terraform-0.12-compatibility.html
I think the only change is removing
Gopkg.lock
, andGopkg.toml
and then running the commands from the above link:Happy to create a PR for this.