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_data_factory_integration_runtime_self_hosted #6535

Conversation

pearcec
Copy link
Contributor

@pearcec pearcec commented Apr 19, 2020

This resource type supports but a standalone Self-hosted and linking via rbac_authorization. The
key_authorization has no documentation other than the REST interface. The Powershell Cmdlet does
not make use of it. So it has been left out.

A full test is setup and necessary for the linked environment to work.

An example and documetnation is included to make the linked setup easier to understand. People
may also reference the test case.

Fixing issue #6503.

@sdebruyn
Copy link
Contributor

I really would like to have this resource. Is there anything I can do to help? I see that it has a documentation label? Does that mean that it needs docs before it can go through? Maybe a CONTRIBUTING.md file could be useful to let us know what we can do to make it easier for you guys :)

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 this pr @pearcec! overall looks good but i've left some comments inline that should be addressed

},
},
},
Set: resourceArmDataFactoryIntegrationRuntimeSelfHostedRbacAuthorizationHash,
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not sure we need a custom hash function here? 🤔

Comment on lines 261 to 263
name := rs.Primary.Attributes["name"]
factoryName := rs.Primary.Attributes["data_factory_name"]
resourceGroup := rs.Primary.Attributes["resource_group_name"]
Copy link
Collaborator

Choose a reason for hiding this comment

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

could we use a resource specific parse ID function here on the resources's id?

Comment on lines 232 to 234
name := rs.Primary.Attributes["name"]
factoryName := rs.Primary.Attributes["data_factory_name"]
resourceGroup, hasResourceGroup := rs.Primary.Attributes["resource_group_name"]
Copy link
Collaborator

Choose a reason for hiding this comment

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

could we use a resource specific parseID function here?

}

resource "azurerm_resource_group" "test" {
name = "acctestRG-%d"
Copy link
Collaborator

Choose a reason for hiding this comment

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

could we use

Suggested change
name = "acctestRG-%d"
name = "acctestRG-df-%d"

}

resource "azurerm_resource_group" "host" {
name = "acctesthostRG-%d"
Copy link
Collaborator

Choose a reason for hiding this comment

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

and

Suggested change
name = "acctesthostRG-%d"
name = "acctestRG-df-%d-host"

Comment on lines 219 to 225
id, err := azure.ParseAzureResourceID(d.Id())
if err != nil {
return err
}
resourceGroup := id.ResourceGroup
factoryName := id.Path["factories"]
name := id.Path["integrationruntimes"]
Copy link
Collaborator

Choose a reason for hiding this comment

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

could we write a parse ID function specific to this resource and use it here like in #5692

Comment on lines 153 to 159
id, err := azure.ParseAzureResourceID(d.Id())
if err != nil {
return err
}
resourceGroup := id.ResourceGroup
factoryName := id.Path["factories"]
name := id.Path["integrationruntimes"]
Copy link
Collaborator

Choose a reason for hiding this comment

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

and a resource specific parse ID function here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

None of these are IDs they are names. So there isn't really any path to parse. Both name and data_factory_name are validated via the schema.

Copy link
Member

Choose a reason for hiding this comment

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

Hi @pearcec
I think Kt was referring to the pattern of a custom parser for the whole resource ID (e.g. /subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.DataFactory/factories/exampleFactoryName/integrationruntimes/exampleIntegrationRuntime which could be parsed into a custom type, and then accessed as id.FactoryName and id.Name - (example here)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok makes sense, I will take a look.

Copy link
Contributor Author

@pearcec pearcec Jun 12, 2020

Choose a reason for hiding this comment

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

Ok I added it. I rebased it as well.

SelfHostedIntegrationRuntimeTypeProperties: expandAzureRmDataFactoryIntegrationRuntimeSelfHostedTypeProperties(d),
}

basicIntegrationRuntime, _ := selfHostedIntegrationRuntime.AsBasicIntegrationRuntime()
Copy link
Collaborator

Choose a reason for hiding this comment

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

we should be checking the result of the cast for nil

),
},

"description": {
Copy link
Collaborator

Choose a reason for hiding this comment

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

we should place optional properties after required

Comment on lines 62 to 67
"auth_key_1": {
Type: schema.TypeString,
Computed: true,
},

"auth_key_2": {
Copy link
Collaborator

Choose a reason for hiding this comment

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

computed properties should go after optional

@pearcec pearcec force-pushed the support-for-azurerm_data_factory_integration_runtime_self_hosted-#6503 branch from e744456 to 972720f Compare May 15, 2020 15:11
@pearcec
Copy link
Contributor Author

pearcec commented May 15, 2020

@katbyte Hi - I made some adjustments and committed the changes. There are also some inline comments to the ParseID request.

@ghost ghost removed the waiting-response label May 15, 2020
@Stanpol
Copy link

Stanpol commented Jun 11, 2020

Can we expect that this PR will be a part of v2.15.0 milestone?

@pearcec
Copy link
Contributor Author

pearcec commented Jun 11, 2020

I updated the code to address @katbyte changes.

Christian Pearce added 4 commits June 12, 2020 09:20
This resource type supports but a standalone Self-hosted and linking via rbac_authorization. The
key_authorization has no documentation other than the REST interface.  The Powershell Cmdlet does
not make use of it.  So it has been left out.

A full test is setup and necessary for the linked environment to work.

An example and documetnation is included to make the linked setup easier to understand.  People
may also reference the test case.

Fixing issue hashicorp#6503.
- Adjust schema for accuracy and ordering
- Clarify response from expandAzureRmDataFactoryIntegrationRuntimeSelfHostedTypeProperties
- Adjust test names
- Rename files to match current refactor
@pearcec pearcec force-pushed the support-for-azurerm_data_factory_integration_runtime_self_hosted-#6503 branch from 972720f to 733cea7 Compare June 12, 2020 13:21
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.

Hi @pearcec - thanks for the updates. Overall this looks good now aside from using the custom parse ID (which we can then add to resource import to check the ID there)

@ghost ghost added size/XXL and removed size/XL labels Jun 12, 2020
@pearcec pearcec requested a review from katbyte June 12, 2020 18:05
@katbyte katbyte changed the title New resource DF Self-host Integration Runtime New resource - azurerm_data_factory_integration_runtime_self_hosted Jun 16, 2020
@katbyte katbyte merged commit bc06656 into hashicorp:master Jun 16, 2020
@katbyte katbyte added this to the v2.15.0 milestone Jun 16, 2020
katbyte added a commit that referenced this pull request Jun 16, 2020
@ghost
Copy link

ghost commented Jun 19, 2020

This has been released in version 2.15.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 = "~> 2.15.0"
}
# ... other configuration ...

@ghost
Copy link

ghost commented Jul 17, 2020

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!

@hashicorp hashicorp locked and limited conversation to collaborators Jul 17, 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.

None yet

5 participants