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

Adds support to specify linux_fx_version for Function Apps #2767

Merged

Conversation

joakimhew
Copy link
Contributor

@joakimhew joakimhew commented Jan 25, 2019

This PR fixes 1937 and allows users to specify the linux_fx_version for azure function apps (resource_arm_function_app.go)

For consistency, I think linux_fx_version is a better option than the alternative mentioned in the issue, as linux_fx_version is already used in App Services.

Copy link
Collaborator

@katbyte katbyte left a comment

Choose a reason for hiding this comment

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

Hi @joakimhew,

Thanks for the enhancement! This looks goo to me aside from a missing test, could we add it to one much like the linux_fx_version is tested for app service?

I suggest adding it to TestAccAzureRMFunctionApp_siteConfig and one of TestAccAzureRMFunctionApp_siteConfigMulti.

Once we have a test this should be good to merge 🙂 Thanks!

@joakimhew
Copy link
Contributor Author

@katbyte Thank you for the review! Should've thought of that of course haha. I'll correct it later and update my PR 👍

@joakimhew
Copy link
Contributor Author

joakimhew commented Jan 31, 2019

@katbyte I've just realised that we also need to allow the user to set the kind field for the function. To enable container based function this need to be set to something like functionapp,linux,container

I'll add kind to the schema and tests for it and update my PR.

EDIT: After further investigation this may be computed somehow. I've tried setting kind in an acceptance test now after adding it to the schema and the create and update function to pass it into the site envelope, but it seems to always revert back to functionapp. I'll have to look more into this and run some manual tests. I'll keep you updated!

EDIT 2:
Okay. tests are passing now. It's a combination of the following properties that will set the kind to functionapp,linux,container:

App Service Plan resource:

properties {
   reserved = true
}

Function App resource:
version = "~2"

@joakimhew joakimhew force-pushed the features/function_app_linux_fx_version branch from 390f251 to 8c85f8e Compare January 31, 2019 14:08
Copy link
Collaborator

@katbyte katbyte left a comment

Choose a reason for hiding this comment

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

Hi @joakimhew,

Thanks for the tests. I've left a few comments inline but it's looking close

azurerm/resource_arm_function_app.go Outdated Show resolved Hide resolved
azurerm/resource_arm_function_app_test.go Outdated Show resolved Hide resolved
@joakimhew
Copy link
Contributor Author

joakimhew commented Feb 1, 2019

@katbyte Once we've resolved the last thing, I'd like to fix the author of my commits as they are currently not set to my GitHub account. This would rewrite history on my joakimhew:features/function_app_linux_fx_version branch, is that okay?

@katbyte
Copy link
Collaborator

katbyte commented Feb 1, 2019

@joakimhew, that is totally fine 🙂 just @me when your ready for a final review and merge!

@joakimhew joakimhew force-pushed the features/function_app_linux_fx_version branch from 647010c to f1b34ff Compare February 2, 2019 17:12
@joakimhew
Copy link
Contributor Author

joakimhew commented Feb 2, 2019

Hi @katbyte!

I've just set kind in schema to only computed and added it as an attribute reference to the docs. I've also changed the author of my commits so everything should be resolved now 🎊 Thanks again!

@ghost ghost removed the waiting-response label Feb 2, 2019
@@ -157,6 +157,8 @@ The following attributes are exported:

* `site_credential` - A `site_credential` block as defined below, which contains the site-level credentials used to publish to this App Service.

* `kind` - The Function App kind - such as `functionapp,linux,container`
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could we separate these values:

Suggested change
* `kind` - The Function App kind - such as `functionapp,linux,container`
* `kind` - The Function App kind - such as `functionapp`, `linux`, `container`

Copy link
Contributor Author

@joakimhew joakimhew Feb 2, 2019

Choose a reason for hiding this comment

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

Sure I could do that, this is how Azure will write it back to the user though. Should I still separate it? (This is an example of an function app with multiple kinds so its actually a valid kind 😀)

Edit:

I think the possible computed kinds for a Function App right now is;
functionapp
functionapp,linux,container

There might be more combinations but I’m not entirely sure. Microsoft’s documentation on this is very lacking unfortunately

Copy link
Collaborator

@katbyte katbyte left a comment

Choose a reason for hiding this comment

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

Hi @joakimhew,

Thanks for the updates, this LGTM now 🚀

@katbyte
Copy link
Collaborator

katbyte commented Feb 2, 2019

tests:

[12:30:02] kt@snowbook:~/hashi/..3../terraform-providers/terraform-provider-azurerm▸features/function_app_linux_fx_version$ testazure TestAccAzureRMFunctionApp
==> Fixing source code with gofmt...
# This logic should match the search logic in scripts/gofmtcheck.sh
gofmt -s -w `find . -name '*.go' | grep -v vendor`
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./azurerm -v -test.run=TestAccAzureRMFunctionApp -timeout 180m -ldflags="-X=github.com/terraform-providers/terraform-provider-azurerm/version.ProviderVersion=acc"
=== RUN   TestAccAzureRMFunctionApp_basic
=== PAUSE TestAccAzureRMFunctionApp_basic
=== RUN   TestAccAzureRMFunctionApp_requiresImport
=== PAUSE TestAccAzureRMFunctionApp_requiresImport
=== RUN   TestAccAzureRMFunctionApp_tags
=== PAUSE TestAccAzureRMFunctionApp_tags
=== RUN   TestAccAzureRMFunctionApp_tagsUpdate
=== PAUSE TestAccAzureRMFunctionApp_tagsUpdate
=== RUN   TestAccAzureRMFunctionApp_appSettings
=== PAUSE TestAccAzureRMFunctionApp_appSettings
=== RUN   TestAccAzureRMFunctionApp_siteConfig
=== PAUSE TestAccAzureRMFunctionApp_siteConfig
=== RUN   TestAccAzureRMFunctionApp_linuxFxVersion
=== PAUSE TestAccAzureRMFunctionApp_linuxFxVersion
=== RUN   TestAccAzureRMFunctionApp_connectionStrings
=== PAUSE TestAccAzureRMFunctionApp_connectionStrings
=== RUN   TestAccAzureRMFunctionApp_siteConfigMulti
=== PAUSE TestAccAzureRMFunctionApp_siteConfigMulti
=== RUN   TestAccAzureRMFunctionApp_updateVersion
=== PAUSE TestAccAzureRMFunctionApp_updateVersion
=== RUN   TestAccAzureRMFunctionApp_3264bit
=== PAUSE TestAccAzureRMFunctionApp_3264bit
=== RUN   TestAccAzureRMFunctionApp_httpsOnly
=== PAUSE TestAccAzureRMFunctionApp_httpsOnly
=== RUN   TestAccAzureRMFunctionApp_consumptionPlan
=== PAUSE TestAccAzureRMFunctionApp_consumptionPlan
=== RUN   TestAccAzureRMFunctionApp_consumptionPlanUppercaseName
=== PAUSE TestAccAzureRMFunctionApp_consumptionPlanUppercaseName
=== RUN   TestAccAzureRMFunctionApp_createIdentity
=== PAUSE TestAccAzureRMFunctionApp_createIdentity
=== RUN   TestAccAzureRMFunctionApp_updateIdentity
=== PAUSE TestAccAzureRMFunctionApp_updateIdentity
=== RUN   TestAccAzureRMFunctionApp_loggingDisabled
=== PAUSE TestAccAzureRMFunctionApp_loggingDisabled
=== RUN   TestAccAzureRMFunctionApp_updateLogging
=== PAUSE TestAccAzureRMFunctionApp_updateLogging
=== CONT  TestAccAzureRMFunctionApp_basic
=== CONT  TestAccAzureRMFunctionApp_3264bit
=== CONT  TestAccAzureRMFunctionApp_siteConfig
=== CONT  TestAccAzureRMFunctionApp_updateVersion
=== CONT  TestAccAzureRMFunctionApp_siteConfigMulti
=== CONT  TestAccAzureRMFunctionApp_updateLogging
=== CONT  TestAccAzureRMFunctionApp_loggingDisabled
=== CONT  TestAccAzureRMFunctionApp_updateIdentity
=== CONT  TestAccAzureRMFunctionApp_createIdentity
--- PASS: TestAccAzureRMFunctionApp_basic (153.15s)
--- PASS: TestAccAzureRMFunctionApp_loggingDisabled (154.82s)
=== CONT  TestAccAzureRMFunctionApp_consumptionPlanUppercaseName
--- PASS: TestAccAzureRMFunctionApp_siteConfig (156.64s)
=== CONT  TestAccAzureRMFunctionApp_consumptionPlan
--- PASS: TestAccAzureRMFunctionApp_updateVersion (176.83s)
=== CONT  TestAccAzureRMFunctionApp_httpsOnly
--- PASS: TestAccAzureRMFunctionApp_updateIdentity (185.98s)
=== CONT  TestAccAzureRMFunctionApp_tags
--- PASS: TestAccAzureRMFunctionApp_3264bit (186.47s)
=== CONT  TestAccAzureRMFunctionApp_tagsUpdate
--- PASS: TestAccAzureRMFunctionApp_updateLogging (216.43s)
=== CONT  TestAccAzureRMFunctionApp_requiresImport
--- PASS: TestAccAzureRMFunctionApp_createIdentity (139.54s)
=== CONT  TestAccAzureRMFunctionApp_appSettings
--- PASS: TestAccAzureRMFunctionApp_httpsOnly (148.47s)
=== CONT  TestAccAzureRMFunctionApp_connectionStrings
--- PASS: TestAccAzureRMFunctionApp_consumptionPlan (176.59s)
=== CONT  TestAccAzureRMFunctionApp_linuxFxVersion
--- PASS: TestAccAzureRMFunctionApp_siteConfigMulti (339.27s)
--- PASS: TestAccAzureRMFunctionApp_tags (156.16s)
--- PASS: TestAccAzureRMFunctionApp_consumptionPlanUppercaseName (188.42s)
--- PASS: TestAccAzureRMFunctionApp_tagsUpdate (172.81s)
--- PASS: TestAccAzureRMFunctionApp_requiresImport (158.40s)
--- PASS: TestAccAzureRMFunctionApp_connectionStrings (151.61s)
--- PASS: TestAccAzureRMFunctionApp_linuxFxVersion (162.18s)
--- PASS: TestAccAzureRMFunctionApp_appSettings (219.76s)
PASS
ok  	github.com/terraform-providers/terraform-provider-azurerm/azurerm	512.490s
[12:40:27] kt@snowbook:~/hashi/..3../terraform-providers/terraform-provider-azurerm▸features/function_app_linux_fx_version$

@katbyte katbyte added this to the 1.22.0 milestone Feb 2, 2019
@katbyte katbyte merged commit 081f935 into hashicorp:master Feb 2, 2019
katbyte added a commit that referenced this pull request Feb 2, 2019
@ghost
Copy link

ghost commented Mar 5, 2019

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 5, 2019
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.

Feature Request: Support for Linux Container based Function Apps
2 participants