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

[service_fabric] Don't pass the reverse proxy port if not set #2747

Merged
merged 4 commits into from
Jan 28, 2019

Conversation

hbuckle
Copy link
Contributor

@hbuckle hbuckle commented Jan 23, 2019

This prevents the reverse proxy port being passed to the API when not specified. Previously if you didn't specify it then a value of 0 was passed, which breaks the cluster provisioning.

I tried adding a test for this using TestCheckNoResourceAttr but I always get Check failed: Check 6/12 error: azurerm_service_fabric_cluster.test: Attribute 'node_type.0.reverse_proxy_endpoint_port' found when not expected so not sure if I am using it correctly?

func TestAccAzureRMServiceFabricCluster_reverseProxyNotSet(t *testing.T) {
	resourceName := "azurerm_service_fabric_cluster.test"
	ri := tf.AccRandTimeInt()
	location := testLocation()
	config := testAccAzureRMServiceFabricCluster_basic(ri, location, 3)

	resource.ParallelTest(t, resource.TestCase{
		PreCheck:     func() { testAccPreCheck(t) },
		Providers:    testAccProviders,
		CheckDestroy: testCheckAzureRMServiceFabricClusterDestroy,
		Steps: []resource.TestStep{
			{
				Config: config,
				Check: resource.ComposeTestCheckFunc(
					testCheckAzureRMServiceFabricClusterExists(resourceName),
					resource.TestCheckResourceAttr(resourceName, "management_endpoint", "http://example:80"),
					resource.TestCheckResourceAttr(resourceName, "add_on_features.#", "0"),
					resource.TestCheckResourceAttr(resourceName, "certificate.#", "0"),
					resource.TestCheckResourceAttr(resourceName, "reverse_proxy_certificate.#", "0"),
					resource.TestCheckNoResourceAttr(resourceName, "node_type.0.reverse_proxy_endpoint_port"),
					resource.TestCheckResourceAttr(resourceName, "client_certificate_thumbprint.#", "0"),
					resource.TestCheckResourceAttr(resourceName, "azure_active_directory.#", "0"),
					resource.TestCheckResourceAttr(resourceName, "diagnostics_config.#", "0"),
					resource.TestCheckResourceAttr(resourceName, "node_type.#", "1"),
					resource.TestCheckResourceAttr(resourceName, "node_type.0.instance_count", "3"),
					resource.TestCheckResourceAttr(resourceName, "tags.%", "0"),
				),
			},
			{
				ResourceName:      resourceName,
				ImportState:       true,
				ImportStateVerify: true,
			},
		},
	})
}

@katbyte
Copy link
Collaborator

katbyte commented Jan 23, 2019

Hi @hbuckle,

Thanks for the PR. I'm not sure why TestCheckNoResourceAttr isn't working, by all accounts it should 🤔 could you push that so i can take a closer look?

In addition could we get a test for updating the port, something like empty -> 7777 -> empty ?

@ghost ghost added size/S and removed size/XS labels Jan 23, 2019
@hbuckle
Copy link
Contributor Author

hbuckle commented Jan 23, 2019

@katbyte I've pushed the test and I'll look at adding the additional update one as well

@ghost ghost added size/M and removed size/S labels Jan 27, 2019
@hbuckle
Copy link
Contributor Author

hbuckle commented Jan 27, 2019

@katbyte It appears from this comment that an unset optional value is set to 0 by Terraform so I've updated the test checks to reflect that. I've also added the update test.

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.

Thanks for the fix @hbuckle, LGTM 👍

@katbyte katbyte merged commit 548798f into hashicorp:master Jan 28, 2019
katbyte added a commit that referenced this pull request Jan 28, 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.

3 participants