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 Resource: azurerm_relay_hybrid_connection #4832

Merged
merged 20 commits into from
Nov 8, 2019
Merged

New Resource: azurerm_relay_hybrid_connection #4832

merged 20 commits into from
Nov 8, 2019

Conversation

DSakura207
Copy link
Contributor

@DSakura207 DSakura207 commented Nov 7, 2019

--- PASS: TestAccAzureRMHybridConnection_basic
--- PASS: TestAccAzureRMHybridConnection_full
--- PASS: TestAccAzureRMHybridConnection_update

Resolution for #1320.

First time pull request 😄

The resource is Azure Relay Hybrid Connection. It is basically the same as Azure App Service Hybrid Connection, while the App Service version requires special user metadata and access policy.

More changes will come, but this is the foundation. To support App Service and App Service Plan, there will be more changes in another pull request.

Copy link
Member

@mbfrahry mbfrahry left a comment

Choose a reason for hiding this comment

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

Hey @DSakura207. These changes look great. I've requested quite a few changes but the comments are almost entirely cleanup/organization focused so we maintain consistency in the provider codebase.

"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/features"
)

func TestAccAzureRMHybridConnection_basic(t *testing.T) {
Copy link
Member

Choose a reason for hiding this comment

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

We should add Relay to these tests names to better categorize them at a glance

Suggested change
func TestAccAzureRMHybridConnection_basic(t *testing.T) {
func TestAccAzureRMRelayHybridConnection_basic(t *testing.T) {

})
}

func TestAccAzureRMHybridConnection_full(t *testing.T) {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
func TestAccAzureRMHybridConnection_full(t *testing.T) {
func TestAccAzureRMRelayHybridConnection_full(t *testing.T) {

})
}

func TestAccAzureRMHybridConnection_update(t *testing.T) {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
func TestAccAzureRMHybridConnection_update(t *testing.T) {
func TestAccAzureRMRelayHybridConnection_update(t *testing.T) {

}

func BuildClient(o *common.ClientOptions) *Client {
NamespacesClient := relay.NewNamespacesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId)
HybridConnectionsClient := relay.NewHybridConnectionsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId)
Copy link
Member

Choose a reason for hiding this comment

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

We should organize these like:

NamespacesClient := relay.NewNamespacesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId)
o.ConfigureClient(&NamespacesClient.Client, o.ResourceManagerAuthorizer)

HybridConnectionsClient := relay.NewHybridConnectionsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId)
o.ConfigureClient(&HybridConnectionsClient.Client, o.ResourceManagerAuthorizer)

@@ -396,6 +396,7 @@ func Provider() terraform.ResourceProvider {
"azurerm_redis_cache": resourceArmRedisCache(),
"azurerm_redis_firewall_rule": resourceArmRedisFirewallRule(),
"azurerm_relay_namespace": resourceArmRelayNamespace(),
"azurerm_relay_hybrid_connection": resourceArmHybridConnection(),
Copy link
Member

Choose a reason for hiding this comment

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

This should be moved up one to keep this list alphabetical

Pending: []string{"Pending"},
Target: []string{"Deleted"},
Refresh: hybridConnectionDeleteRefreshFunc(ctx, client, resourceGroup, relayNamespace, name),
Timeout: 60 * time.Minute,
Copy link
Member

Choose a reason for hiding this comment

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

In the Timeout section defined in the schema, you defined the Delete timeout as 30 minutes. We should sync these up so this is either 30 minutes or the delete timeout defined above is 60 minutes.


resource "azurerm_relay_hybrid_connection" "test" {
name = "acctestrnhc-%d"
resource_group_name = "${azurerm_resource_group.test.name}"
Copy link
Member

Choose a reason for hiding this comment

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

Adding a space so the equals sign lines up a little better

Suggested change
resource_group_name = "${azurerm_resource_group.test.name}"
resource_group_name = "${azurerm_resource_group.test.name}"


resource "azurerm_relay_hybrid_connection" "test" {
name = "acctestrnhc-%d"
resource_group_name = "${azurerm_resource_group.test.name}"
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
resource_group_name = "${azurerm_resource_group.test.name}"
resource_group_name = "${azurerm_resource_group.test.name}"

}

resource "azurerm_relay_hybrid_connection" "test" {
name = "acctestrnhc-%d"
Copy link
Member

Choose a reason for hiding this comment

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

We should line all these equal signs up

%s

resource "azurerm_relay_namespace" "import" {
name = "acctestrnhc-%d"
Copy link
Member

Choose a reason for hiding this comment

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

We should line all these equal signs up

@mbfrahry
Copy link
Member

mbfrahry commented Nov 7, 2019

Also, thank you for submitting your first PR! This is a great start

@mbfrahry mbfrahry self-assigned this Nov 7, 2019
Copy link
Contributor Author

@DSakura207 DSakura207 left a comment

Choose a reason for hiding this comment

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

Hello @mbfrahry , thanks for your quick reply. I've update my branch with your suggestions. Hopefully my finger is not fat so that the commit can pass checks 🤞

@mbfrahry mbfrahry changed the title New Resource: azurerm_relay_hybrid_connection New Resource: azurerm_relay_hybrid_connection Nov 8, 2019
Copy link
Member

@mbfrahry mbfrahry left a comment

Choose a reason for hiding this comment

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

This all looks great! Thanks for fixing it up.

@mbfrahry mbfrahry merged commit 2d553f4 into hashicorp:master Nov 8, 2019
@mbfrahry
Copy link
Member

mbfrahry commented Nov 8, 2019

@DSakura207, thanks again for working on this. It should make it into the next release

@DSakura207 DSakura207 deleted the f/hybridconnections branch November 8, 2019 15:29
@ghost
Copy link

ghost commented Dec 8, 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 👉 hashibot-feedback@hashicorp.com. Thanks!

@ghost ghost locked and limited conversation to collaborators Dec 8, 2019
@katbyte katbyte added this to the v1.38.0 milestone Jan 6, 2020
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