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

New Beta Resources - azurerm_linux_function_app_slot and azurerm_windows_function_app_slot #14940

Merged
merged 15 commits into from
Feb 2, 2022

Conversation

jackofallops
Copy link
Member

@jackofallops jackofallops commented Jan 13, 2022

Also updates docs and fixes a number of related issues in the [windows|linux]_function_app resources uncovered.

Copy link
Member

@mbfrahry mbfrahry left a comment

Choose a reason for hiding this comment

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

This is looking good so far! I just have quite a few confirmation checks and some extra validation

},
"retention_period_days": {
Type: pluginsdk.TypeInt,
Optional: true,
ValidateFunc: validation.IntBetween(0, 99999),
Description: "The retention period for logs in days. Valid values are between `0` and `99999`. Defaults to `0` (never delete).",
Copy link
Member

Choose a reason for hiding this comment

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

Do we want to add Default: 0? Or is that taken care of because ints already default to 0? It might be worth adding just to keep it in line with how we normally default things?

Copy link
Member Author

Choose a reason for hiding this comment

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

iirc the default is "not set", so defining a default would possibly change the behaviour of the service... I'll add some tests around this to confirm.


"scm_ip_restriction": IpRestrictionSchema(),

"load_balancing_mode": { // Supported on Function Apps?
Copy link
Member

Choose a reason for hiding this comment

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

Let's check that this works before merging

Copy link
Member Author

Choose a reason for hiding this comment

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

I've tested this manually, and it does work (or at least is successfully reflected in the resource configuration), just needs coverage in the acceptance tests I think.


"scm_ip_restriction": IpRestrictionSchema(),

"load_balancing_mode": { // Supported on Function Apps?
Copy link
Member

Choose a reason for hiding this comment

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

And check here

Copy link
Member Author

Choose a reason for hiding this comment

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

as above.

Optional: true,
Computed: true,
ValidateFunc: validation.IntBetween(2, 10),
Description: "The amount of time in minutes that a node is unhealthy before being removed from the load balancer. Possible values are between `2` and `10`. Defaults to `10`. Only valid in conjunction with `health_check_path`",
Copy link
Member

Choose a reason for hiding this comment

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

I think we can add RequiredWith: []string{"health_check_path"} for one extra layer of validation

Copy link
Member Author

Choose a reason for hiding this comment

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

these are not tied together,health_check_path provides an optional "thing" to check for health, otherwise the check just makes sure it gets a 200 from the deployed site.

Description: "Should all outbound traffic to have Virtual Network Security Groups and User Defined Routes applied? Defaults to `false`.",
},

"detailed_error_logging_enabled": {
Copy link
Member

Choose a reason for hiding this comment

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

Just want to confirm that this can't be set

Copy link
Member Author

Choose a reason for hiding this comment

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

More that it shouldn't be set. This value is calculated from other configuration elsewhere (specifically the logs blocks)


"detailed_error_logging_enabled": {
Type: pluginsdk.TypeBool,
Computed: true,
Copy link
Member

Choose a reason for hiding this comment

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

Looking to confirm we can't set this

Copy link
Member Author

Choose a reason for hiding this comment

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

as above


"linux_fx_version": {
Type: pluginsdk.TypeString,
Computed: true,
Copy link
Member

Choose a reason for hiding this comment

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

And looking to confirm if we can't set this

Copy link
Member Author

Choose a reason for hiding this comment

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

as per windows_fx_version above

switch tier := *planSku.Tier; strings.ToLower(tier) {
case "dynamic": // Consumption Plan modifications to request
sendContentSettings = false
case "elastic": // ElasticPremium Plan modifications to request?
Copy link
Member

Choose a reason for hiding this comment

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

Do we need to do anything for this case?

Copy link
Member Author

Choose a reason for hiding this comment

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

This switch is being used to call out that there are potentially differences in data sent for different plan types, the intention of leaving in those currently without special modifications is to provide readiness / hints about where/how to do so if needed in future. Since this case is empty, it just drops through, so I felt it was low enough cost to provide hints to future development.

if _, ok := metadata.ResourceData.GetOk("app_settings.WEBSITE_CONTENTSHARE"); ok {
appSettings[k] = utils.NormalizeNilableString(v)
}
case "WEBSITE_HTTPLOGGING_RETENTION_DAYS":
Copy link
Member

Choose a reason for hiding this comment

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

Do we need to do anything here?

Copy link
Member Author

Choose a reason for hiding this comment

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

In this case, the switch is used to filter out settings that are configured elsewhere and would otherwise make app_settings impossible to manage correctly in state. Some cases this information is set into the respective locations in the schema, and others (like this) are simply filtered out as the service has a different primary attribute with this information in.

m.FunctionExtensionsVersion = utils.NormalizeNilableString(v)

case "WEBSITE_NODE_DEFAULT_VERSION": // Note - This is only set if it's not the default of 12, but we collect it from WindowsFxVersion so can discard it here
case "WEBSITE_CONTENTAZUREFILECONNECTIONSTRING":
Copy link
Member

Choose a reason for hiding this comment

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

Do we need to do anything for these next 4 cases?

Copy link
Member Author

Choose a reason for hiding this comment

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

As above...

@jackofallops jackofallops marked this pull request as ready for review January 21, 2022 11:32
Copy link
Member

@mbfrahry mbfrahry left a comment

Choose a reason for hiding this comment

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

LGTM after reviewing the comments from the last review!

@jackofallops jackofallops force-pushed the f/win-linux-func-app-slots branch from 0fae3a5 to a1deeb7 Compare February 2, 2022 09:39
@jackofallops jackofallops added this to the v2.95.0 milestone Feb 2, 2022
@jackofallops
Copy link
Member Author

Tests looking good:

image

@jackofallops jackofallops merged commit 90e3692 into main Feb 2, 2022
@jackofallops jackofallops deleted the f/win-linux-func-app-slots branch February 2, 2022 11:30
jackofallops added a commit that referenced this pull request Feb 2, 2022
@github-actions
Copy link

github-actions bot commented Feb 4, 2022

This functionality has been released in v2.95.0 of the Terraform Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@github-actions
Copy link

github-actions bot commented Mar 7, 2022

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 7, 2022
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