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 Data Source: azurerm_express_route_circuit #3158

Merged
merged 8 commits into from
Apr 16, 2019

Conversation

romitgirdhar
Copy link
Contributor

This addresses Issue #3022
All tests passing

@ghost ghost added the size/L label Apr 3, 2019
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 @romitgirdhar

Thanks for this PR :)

I've taken a look through and left some comments inline, but this is off to a good start - if we can fix up the comments then we should be able to kick off the tests and get this merged 👍

Thanks!

},

"service_provider_properties": {
Type: schema.TypeSet,
Copy link
Contributor

Choose a reason for hiding this comment

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

due to a bug in Terraform Core this'll need to be a TypeList unfortunately - as such can we make this:

Suggested change
Type: schema.TypeSet,
Type: schema.TypeList,

},

"sku": {
Type: schema.TypeSet,
Copy link
Contributor

Choose a reason for hiding this comment

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

(as above) since this is a Data Source there's a known bug with Sets, so can we update this to be a List:

Suggested change
Type: schema.TypeSet,
Type: schema.TypeList,

dataSourceName := "data.azurerm_express_route_circuit.test"
ri := tf.AccRandTimeInt()

}*/
Copy link
Contributor

Choose a reason for hiding this comment

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

since this is unused, can we remove this?

if err := d.Set("sku", sku); err != nil {
return fmt.Errorf("Error setting `sku`: %+v", err)
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

(since this is the same in the other resource, it's fine to leave this as-is for now) in general we'd tend to ensure the sku block was always set, for example by making this:

sku := flattenExpressRouteCircuitSku(resp.Sku)
if err := d.Set("sku", sku); err != nil {
  return fmt.Errorf("Error setting `sku`: %+v", err)
}

(e.g. by removing the surrounding if)

and then updating the flattenExpressRouteCircuitSku method to be:

func flattenExpressRouteCircuitSku(sku *network.ExpressRouteCircuitSku) []interface{} {
	if sku == nil {
	  return []interface{}{}
	}

	return []interface{}{
		map[string]interface{}{
			"tier":   string(sku.Tier),
			"family": string(sku.Family),
		},
	}
}

(but as mentioned above, since this is the same in the resource this is fine for now, just for info 😄)

"github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils"
)

func dataSourceArmExpressRouteCircuit() *schema.Resource {
Copy link
Contributor

Choose a reason for hiding this comment

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

"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/tf"
)

func TestAccDataSourceAzureRMExpressRoute_basic(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

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

since there's a limit on the number of ExpressRoute's which can be provisioned at one time (and we run the tests in parallel) - we'll need to make this an internal method (by making it lower-case) and then ensure it's called from within this test function in the Express Route resource

(but to make this simpler to test, we probably want to do this when all the other changes are done 😄)

Copy link
Contributor Author

@romitgirdhar romitgirdhar Apr 9, 2019

Choose a reason for hiding this comment

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

Since it only has the 1 test in there, do we need the function? Also, should we add this function to the test function (in the resource file) or should we create a similar function in this test file?

}*/

func testAccDataSourceAzureRMExpressRoute_basic(rInt int, location string) string {
config := testAccAzureRMExpressRouteCircuit_MeteredBasic(rInt, location)
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's what I meant to do. But, the subscription I used to test did not support the Express Route configuration that is hard-coded in the test you referenced. But, I checked another subscription and it looks like it does support those configurations. I'll make the change. thanks!

…the flag for ExpressRouteGatewayBypass to VNETGatewayConnection Resource
@ghost ghost added size/XL documentation and removed size/L labels Apr 10, 2019
@romitgirdhar
Copy link
Contributor Author

I made the requested changes. Additionally, I've also added the ExpressRouteGatewayBypass flag to the Virtual network gateway connection resource. This should address issue #3027

@ghost ghost removed the waiting-response label Apr 10, 2019
@romitgirdhar
Copy link
Contributor Author

Hello @tombuildsstuff - Any updates on this PR? Thank you!

@tombuildsstuff tombuildsstuff dismissed their stale review April 16, 2019 08:18

dismissing since changes have been pushed

@tombuildsstuff
Copy link
Contributor

@romitgirdhar I hope you don't mind but I've merged master in/rebased this

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 @romitgirdhar

Thanks for pushing those changes - this now LGTM 👍

Thanks!

@tombuildsstuff tombuildsstuff added this to the v1.25.0 milestone Apr 16, 2019
@tombuildsstuff tombuildsstuff changed the title Added Data source for Express route Circuit New Data Source: azurerm_express_route_circuit Apr 16, 2019
@tombuildsstuff
Copy link
Contributor

Ignoring an existing test failure (due to an API change) the tests pass:

------- Stdout: -------
=== RUN   TestAccAzureRMExpressRouteCircuit
=== RUN   TestAccAzureRMExpressRouteCircuit/basic
=== RUN   TestAccAzureRMExpressRouteCircuit/basic/data_basic
=== PAUSE TestAccAzureRMExpressRouteCircuit/basic/data_basic
=== RUN   TestAccAzureRMExpressRouteCircuit/basic/metered
=== RUN   TestAccAzureRMExpressRouteCircuit/basic/unlimited
=== RUN   TestAccAzureRMExpressRouteCircuit/basic/update
=== RUN   TestAccAzureRMExpressRouteCircuit/basic/allowClassicOperationsUpdate
=== RUN   TestAccAzureRMExpressRouteCircuit/basic/requiresImport
=== RUN   TestAccAzureRMExpressRouteCircuit/basic/tierUpdate
=== RUN   TestAccAzureRMExpressRouteCircuit/basic/premiumMetered
=== RUN   TestAccAzureRMExpressRouteCircuit/basic/premiumUnlimited
=== CONT  TestAccAzureRMExpressRouteCircuit/basic/data_basic
=== RUN   TestAccAzureRMExpressRouteCircuit/PrivatePeering
=== RUN   TestAccAzureRMExpressRouteCircuit/PrivatePeering/azurePrivatePeering
=== RUN   TestAccAzureRMExpressRouteCircuit/PrivatePeering/requiresImport
=== RUN   TestAccAzureRMExpressRouteCircuit/MicrosoftPeering
=== RUN   TestAccAzureRMExpressRouteCircuit/MicrosoftPeering/microsoftPeering
=== RUN   TestAccAzureRMExpressRouteCircuit/authorization
=== RUN   TestAccAzureRMExpressRouteCircuit/authorization/basic
=== PAUSE TestAccAzureRMExpressRouteCircuit/authorization/basic
=== RUN   TestAccAzureRMExpressRouteCircuit/authorization/multiple
=== PAUSE TestAccAzureRMExpressRouteCircuit/authorization/multiple
=== RUN   TestAccAzureRMExpressRouteCircuit/authorization/requiresImport
=== CONT  TestAccAzureRMExpressRouteCircuit/authorization/basic
=== CONT  TestAccAzureRMExpressRouteCircuit/authorization/multiple
--- FAIL: TestAccAzureRMExpressRouteCircuit (1871.08s)
    --- PASS: TestAccAzureRMExpressRouteCircuit/basic (1038.06s)
        --- PASS: TestAccAzureRMExpressRouteCircuit/basic/metered (140.92s)
        --- PASS: TestAccAzureRMExpressRouteCircuit/basic/unlimited (139.06s)
        --- PASS: TestAccAzureRMExpressRouteCircuit/basic/update (170.05s)
        --- PASS: TestAccAzureRMExpressRouteCircuit/basic/allowClassicOperationsUpdate (159.91s)
        --- SKIP: TestAccAzureRMExpressRouteCircuit/basic/requiresImport (0.00s)
            resource_arm_express_route_circuit_test.go:84: Skipping since resources aren't required to be imported
        --- PASS: TestAccAzureRMExpressRouteCircuit/basic/tierUpdate (157.95s)
        --- PASS: TestAccAzureRMExpressRouteCircuit/basic/premiumMetered (128.26s)
        --- PASS: TestAccAzureRMExpressRouteCircuit/basic/premiumUnlimited (141.90s)
        --- PASS: TestAccAzureRMExpressRouteCircuit/basic/data_basic (206.48s)
    --- FAIL: TestAccAzureRMExpressRouteCircuit/PrivatePeering (137.34s)
        --- FAIL: TestAccAzureRMExpressRouteCircuit/PrivatePeering/azurePrivatePeering (137.34s)
            testing.go:538: Step 0 error: Error applying: 1 error occurred:
                	* azurerm_express_route_circuit_peering.test: 1 error occurred:
                	* azurerm_express_route_circuit_peering.test: Code="InvalidCharactersInSharedKey" Message="The specified shared key contains invalid characters." Details=[]
                
                
                
                
        --- SKIP: TestAccAzureRMExpressRouteCircuit/PrivatePeering/requiresImport (0.00s)
            resource_arm_express_route_circuit_peering_test.go:44: Skipping since resources aren't required to be imported
    --- PASS: TestAccAzureRMExpressRouteCircuit/MicrosoftPeering (290.33s)
        --- PASS: TestAccAzureRMExpressRouteCircuit/MicrosoftPeering/microsoftPeering (290.33s)
    --- PASS: TestAccAzureRMExpressRouteCircuit/authorization (0.00s)
        --- SKIP: TestAccAzureRMExpressRouteCircuit/authorization/requiresImport (0.00s)
            resource_arm_express_route_circuit_authorization_test.go:41: Skipping since resources aren't required to be imported
        --- PASS: TestAccAzureRMExpressRouteCircuit/authorization/multiple (193.70s)
        --- PASS: TestAccAzureRMExpressRouteCircuit/authorization/basic (198.88s)
FAIL

@tombuildsstuff tombuildsstuff merged commit 25a6ea9 into hashicorp:master Apr 16, 2019
tombuildsstuff added a commit that referenced this pull request Apr 16, 2019
@ghost
Copy link

ghost commented Apr 17, 2019

This has been released in version 1.25.0 of the provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. As an example:

provider "azurerm" {
	version = "~> 1.25.0"
}
# ... other configuration ...

@ghost
Copy link

ghost commented May 17, 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 May 17, 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.

2 participants