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 possible_outbound_ip_addresses to app service #2513

Conversation

tomasaschan
Copy link
Contributor

This is useful for e.g. setting up firewall rules for Azure SQL - since an App Service can be rescheduled, it's possible that the outbound_ip_addresses field output at deploy-time does not catch all IP addresses you need to open up to be future-safe.

Note: I couldn't get the code to build and run tests on my Windows machine (neither from PowerShell, inspecting the makefile to see what was required, nor from WSL), so I've basically just looked at #700 to see what I need to do to support this. (I think this could have been made easier with a .gitattributes and an .editorconfig at the project root, that - at the very least - specify line endings to be what we expect.) Please feel free to request changes if I missed something 😄

@katbyte
Copy link
Collaborator

katbyte commented Dec 18, 2018

@tomasaschan,

I think this may be better to export as a TypeList rather than a comma separated field. However in that case we should probably also update oubound_ip_addresses to match?

@tomasaschan
Copy link
Contributor Author

tomasaschan commented Dec 18, 2018

Yeah, I actually thought so too, but decided to follow #700 as closely as possible. The rationale in the discussion there was that it's easy enough to get that list using split if one needs it.

I think it's reasonable that they match, but I don't really care which way as long as they both go the same way :) But since changing outbound_ip_addresses would be a breaking change, while this isn't, I also figured this can be added with less friction, and a new PR that changes the return type of both attributes can be made in the 2.0 scope.

@katbyte
Copy link
Collaborator

katbyte commented Dec 19, 2018

Rational decision to me @tomasaschan, CSV for now it is!

Copy link
Contributor

@metacpp metacpp left a comment

Choose a reason for hiding this comment

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

Hi @tomasaschan

Thanks for the contribution. In general, it looks good to me, however it appears that you missed adding the schema and documentation for the data source.

And could we add some validations for this new field in data source and resource test ?

azurerm/data_source_app_service.go Show resolved Hide resolved
website/docs/r/app_service.html.markdown Show resolved Hide resolved
@katbyte
Copy link
Collaborator

katbyte commented Dec 19, 2018

For the test you could just add it to the basic one, like:

func TestAccDataSourceAzureRMAppService_basic(t *testing.T) {
	dataSourceName := "data.azurerm_app_service.test"
	rInt := acctest.RandInt()
	location := testLocation()

	resource.ParallelTest(t, resource.TestCase{
		PreCheck:  func() { testAccPreCheck(t) },
		Providers: testAccProviders,
		Steps: []resource.TestStep{
			{
				Config: testAccDataSourceAppService_basic(rInt, location),
				Check: resource.ComposeTestCheckFunc(
					resource.TestCheckResourceAttrSet(dataSourceName, "app_service_plan_id"),
					resource.TestCheckResourceAttrSet(dataSourceName, "possible_outbound_ip_addresses"),
					resource.TestCheckResourceAttrSet(dataSourceName, "outbound_ip_addresses"),
					resource.TestCheckResourceAttr(dataSourceName, "tags.%", "0"),
				),
			},
		},
	})
}

@tomasaschan
Copy link
Contributor Author

tomasaschan commented Dec 20, 2018

@katbyte @metacpp Thanks for the review! I honestly hadn't thought about the data source getting the same properties, but of course that makes sense. I've added the new property to the schema for the data source as well.

I've also added a few assertions to the basic tests for both resource and data source, as well as documentation of these properties to the data source (it seems the reason I missed it in the first place is that the outbound_ip_addresses property was not documented either). I hope the tests look good like this, as I haven't been able to run them locally.

@ghost ghost removed the waiting-response label Dec 20, 2018
Copy link
Contributor

@tombuildsstuff tombuildsstuff left a comment

Choose a reason for hiding this comment

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

hey @tomasaschan

Thanks for pushing those changes - this now LGTM, I'll kick off the tests shortly 👍

Thanks!

@tombuildsstuff tombuildsstuff dismissed metacpp’s stale review December 20, 2018 13:28

dismissing since changes have been pushed

@tombuildsstuff
Copy link
Contributor

Data Source tests pass:

screenshot 2018-12-20 at 13 32 11

@tombuildsstuff
Copy link
Contributor

Resource tests pass:

screenshot 2018-12-20 at 14 12 18

@tombuildsstuff tombuildsstuff merged commit cec51b2 into hashicorp:master Dec 20, 2018
tombuildsstuff added a commit that referenced this pull request Dec 20, 2018
@tomasaschan
Copy link
Contributor Author

Woop woop! Thanks for taking this - will significantly simplify my deployments, once released 🎉

@tomasaschan tomasaschan deleted the possible-outbound-ip-addresses-on-app-service branch December 20, 2018 16:08
@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.

4 participants