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

Add azure app service plan module #555

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

tsalright
Copy link

Adding to the Azure offerings in terratest #89
Adding App Service Plan module #548

Adding .terraform-version for anyone using tfenv to manage their terraform versions.

@brikis98
Copy link
Member

Please see #89 for the status on Terratest with Azure. In particular, we're starting some work around it, and when that work is done, we'll be able to come back to this PR!

Copy link
Contributor

@yorinasub17 yorinasub17 left a comment

Choose a reason for hiding this comment

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

Looks like this just needs to be refreshed with the new patterns we identified in the other PRs and it will be good to go!

Also once updated can you provide the link to the build? Thanks!

@@ -0,0 +1 @@
0.12.24
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should remove this. This is useful in principle, but since we constantly want to test with newer terraform versions for compatibility, this actually hinders our ability in practice.

@@ -0,0 +1,53 @@
# Terraform Azure App Service Plan Example
Copy link
Contributor

Choose a reason for hiding this comment

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

Reminder to update to the new README style.

# ---------------------------------------------------------------------------------------------------------------------
# DEPLOY AN AZURE APP SERVICE PLAN
# This is an example of how to deploy an Azure App Service Plan
# ---------------------------------------------------------------------------------------------------------------------
Copy link
Contributor

Choose a reason for hiding this comment

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


# ------------------------------------------------------------------------------
# CONFIGURE OUR AZURE CONNECTION
# ------------------------------------------------------------------------------
Copy link
Contributor

Choose a reason for hiding this comment

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

NIT: bar length is not the same as the other blocks.


tags = azurerm_resource_group.rg.tags
kind = var.kind
reserved = lower(var.kind) == "linux" ? true : lower(var.kind) == "windows" || lower(var.kind) == "app" ? false : var.reserved
Copy link
Contributor

Choose a reason for hiding this comment

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

NIT: We've found that combined conditionals are much easier to read when you break it up into multiple lines with parens:

Suggested change
reserved = lower(var.kind) == "linux" ? true : lower(var.kind) == "windows" || lower(var.kind) == "app" ? false : var.reserved
reserved = (
lower(var.kind) == "linux"
? true
: (
lower(var.kind) == "windows" || lower(var.kind) == "app"
? false
: var.reserved
)
)

(NOTE: you might have to run terraform fmt if you commit the suggestion directly)

@@ -0,0 +1,3 @@
output "planids" {
value = "${azurerm_app_service_plan.plan.*.id}"
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you intend this to be a list? Or a string? If string, might be better to join them using some delimitter.

@@ -0,0 +1,55 @@
variable "resourceGroupName" {
Copy link
Contributor

Choose a reason for hiding this comment

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

NIT:

  • Need the standard variable blocks that break up into the sections Env Vars, Required Vars, and Optional Vars.
  • The standard style order of variables we use is description, type, default in that order.

return plan
}

func getAppServicePlanE(planName string, resGroupName string, subscriptionID string) (*web.AppServicePlan, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Expose as public as we discussed in the other PR.

// GetAppServicePlan gets the AppServicePlan.
// planName - required to find the AppServicePlan.
// resGroupName - use an empty string if you have the AZURE_RES_GROUP_NAME environment variable set
// subscriptionId - use an empty string if you have the ARM_SUBSCRIPTION_ID environment variable set
Copy link
Contributor

Choose a reason for hiding this comment

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

NIT: Add the boilerplate comment about failing the test.

Comment on lines +30 to +31
var expectedSkuCapacity int32
expectedSkuCapacity = 1
Copy link
Contributor

Choose a reason for hiding this comment

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

NIT:

Suggested change
var expectedSkuCapacity int32
expectedSkuCapacity = 1
expectedSkuCapacity := int32(1)

@rguthriemsft
Copy link
Contributor

@tsalright any issue if I pick up this PR and bring it up to date?

@tsalright
Copy link
Author

@rguthriemsft go for it. I have been swamped and unable to visit this stuff in a while. Hoping to get back into this stuff in a couple months.

@rguthriemsft
Copy link
Contributor

@tsalright I think I have access to your fork, if not will ping you. I might pull the branch into our fork so I can run CI will let you know if I hit issues.

@tsalright
Copy link
Author

@rguthriemsft sounds good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants