-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Conversation
There was a problem hiding this 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, |
There was a problem hiding this comment.
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:
Type: schema.TypeSet, | |
Type: schema.TypeList, |
}, | ||
|
||
"sku": { | ||
Type: schema.TypeSet, |
There was a problem hiding this comment.
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:
Type: schema.TypeSet, | |
Type: schema.TypeList, |
dataSourceName := "data.azurerm_express_route_circuit.test" | ||
ri := tf.AccRandTimeInt() | ||
|
||
}*/ |
There was a problem hiding this comment.
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) | ||
} | ||
} |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could we add some documentation for this data source and a link to the sidebar?
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/tf" | ||
) | ||
|
||
func TestAccDataSourceAzureRMExpressRoute_basic(t *testing.T) { |
There was a problem hiding this comment.
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 😄)
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rather than re-defining this we should be able to call the testAccAzureRMExpressRouteCircuit_basicMeteredConfig
test method within the Express Route resource
There was a problem hiding this comment.
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
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 |
Hello @tombuildsstuff - Any updates on this PR? Thank you! |
dismissing since changes have been pushed
@romitgirdhar I hope you don't mind but I've merged master in/rebased this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
azurerm_express_route_circuit
Ignoring an existing test failure (due to an API change) the tests pass:
|
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 ... |
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! |
This addresses Issue #3022
All tests passing