-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
New Resource - azurerm_linux_function_app_flex_consumption
#28199
base: main
Are you sure you want to change the base?
Conversation
@xiaxyi - thank you for this PR. Only note from me is we don't want customers to worry about operating system, with no plans for a Windows version of Flex Consumption in the foreseeable future. Can we please simplify the name and code not to have Linux in it for Flex Consumption? Other than that I'm happy with separating it out into its own resource type, thank you. |
Thanks @nzthiago for the suggestions, @jackofallops are you agree with the idea of removing the |
Following up on this one @jackofallops - from the Azure Functions PG we would prefer to drop 'linux' from the resource name. |
@jackofallops : Could you please update on @nzthiago 's suggestions? We are eagerly waiting for this actually. |
Happy New Year @jackofallops. Could you be able to check on the suggestions? |
@xiaxyi please go ahead and remove |
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.
@xiaxyi, as a heads up this will require a few rounds of reviews, but I've made a first pass through to call out some consistency and style choices. Could you fix those up? I can then go over this in detail with our App Service SME.
Thanks!
AppCommandLine string `tfschema:"app_command_line"` | ||
ApiDefinition string `tfschema:"api_definition_url"` | ||
ApiManagementConfigId string `tfschema:"api_management_api_id"` | ||
AppInsightsInstrumentationKey string `tfschema:"application_insights_key"` // App Insights Instrumentation Key |
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.
Can we remove this comment here since it isn't really alluding to anything helpful (the name is already descriptive)
AppInsightsInstrumentationKey string `tfschema:"application_insights_key"` // App Insights Instrumentation Key | |
AppInsightsInstrumentationKey string `tfschema:"application_insights_key"` |
Http2Enabled bool `tfschema:"http2_enabled"` | ||
IpRestriction []IpRestriction `tfschema:"ip_restriction"` | ||
IpRestrictionDefaultAction string `tfschema:"ip_restriction_default_action"` | ||
LoadBalancing string `tfschema:"load_balancing_mode"` // TODO - Valid for FunctionApps? |
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.
Is this comment relevant here?
LoadBalancing string `tfschema:"load_balancing_mode"` // TODO - Valid for FunctionApps? | |
LoadBalancing string `tfschema:"load_balancing_mode"` |
RuntimeScaleMonitoring bool `tfschema:"runtime_scale_monitoring_enabled"` | ||
ScmIpRestriction []IpRestriction `tfschema:"scm_ip_restriction"` | ||
ScmIpRestrictionDefaultAction string `tfschema:"scm_ip_restriction_default_action"` | ||
ScmType string `tfschema:"scm_type"` // Computed? |
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.
Same here
ScmType string `tfschema:"scm_type"` // Computed? | |
ScmType string `tfschema:"scm_type"` |
Optional: true, | ||
Description: "The path to be checked for this function app health.", | ||
RequiredWith: func() []string { | ||
if features.FourPointOhBeta() { |
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.
4.0 has been shipped so we shouldn't be using this flag anywhere anymore
Computed: !features.FourPointOhBeta(), | ||
ValidateFunc: validation.IntBetween(2, 10), | ||
RequiredWith: func() []string { | ||
if features.FourPointOhBeta() { |
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.
Same here
if existing.Model == nil || existing.Model.Properties == nil { | ||
return fmt.Errorf("reading of Linux %s for update", id) | ||
} |
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.
For consistency these checks should be split and return the following error messages
if existing.Model == nil || existing.Model.Properties == nil { | |
return fmt.Errorf("reading of Linux %s for update", id) | |
} | |
if existing.Model == nil { | |
return fmt.Errorf("reading %s: `model` was nil", id) | |
} | |
existing.Model.Properties == nil { | |
return fmt.Errorf("reading %s: `properties` was nil", id) | |
} |
if response.WasNotFound(resp.HttpResponse) { | ||
return pointer.To(false), nil | ||
} | ||
return nil, fmt.Errorf("retrieving Linux Function App %s: %+v", id, err) |
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.
We don't check for 404 in the exists check for the tests, any error when we try to get the resource in this check should be returned
if response.WasNotFound(resp.HttpResponse) { | |
return pointer.To(false), nil | |
} | |
return nil, fmt.Errorf("retrieving Linux Function App %s: %+v", id, err) | |
return nil, fmt.Errorf("retrieving %s: %+v", id, err) |
if response.WasNotFound(resp.HttpResponse) { | ||
return pointer.To(false), 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.
if response.WasNotFound(resp.HttpResponse) { | |
return pointer.To(false), nil | |
} |
if response.WasNotFound(resp.HttpResponse) { | ||
return pointer.To(false), nil | ||
} | ||
return pointer.To(true), 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.
The existence of a Model in the response confirms whether the resource exists or not
return pointer.To(true), nil | |
return pointer.To(resp.Model != nil), nil |
%s | ||
resource "azurerm_linux_function_app_flex_consumption" "test" { | ||
name = "xiaxintest-LFA-tf%d" |
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.
Resource names in the acceptance tests should begin with acc
@stephybun Thanks for the review, I understand it will take server rounds of review, that's totally fine. I updated the pr based on the comments, feel free to let me know if anything needed. |
I believe, |
@stephybun I believe this is ready for the next round of review, thank you |
Community Note
Description
To make a separate pr for this new feature, referring to the #27531
PR Checklist
For example: “
resource_name_here
- description of change e.g. adding propertynew_property_name_here
”Changes to existing Resource / Data Source
Testing
Change Log
Below please provide what should go into the changelog (if anything) conforming to the Changelog Format documented here.
azurerm_resource
- support for thething1
property [GH-00000]This is a (please select all that apply):
Related Issue(s)
Fixes #0000
Note
If this PR changes meaningfully during the course of review please update the title and description as required.