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

Hooks for certain resources to handle cases like the "association" resources #3

Closed
magodo opened this issue Aug 23, 2021 · 2 comments · Fixed by #238
Closed

Hooks for certain resources to handle cases like the "association" resources #3

magodo opened this issue Aug 23, 2021 · 2 comments · Fixed by #238
Labels
enhancement New feature or request

Comments

@magodo
Copy link
Collaborator

magodo commented Aug 23, 2021

There are some special terraform resources in the AzureRM provider, which is not a concrete Azure resource, but some logical concept to "associate" two concrete resources. Propose to add some kind of hooks to support them.

@magodo magodo added the enhancement New feature or request label Aug 23, 2021
@magodo
Copy link
Collaborator Author

magodo commented Sep 23, 2022

With #231 merged, there is now an proper place to put such logic to: https://github.com/Azure/aztfy/blob/4d45e8416c06ecc6b643748bef1d6280b11672e4/internal/resourceset/azure_resource_set_hack.go#L22

Currently, the azurerm_virtual_machine_data_disk_attachment is supported, we will need to support the others. The full list can be found at: https://github.com/magodo/aztft/blob/3dfe6a12ed5ee515b6f9281ed307c54211ee35b3/tool/aztft-import/main.go#L45.

Note:

  1. If populating the "master" resource needs its API body, we should also add it to the PopulateResourceTypesNeedsBody
  2. The association resource will eed an Azure resource id](https://github.com/Azure/aztfy/blob/4d45e8416c06ecc6b643748bef1d6280b11672e4/internal/resourceset/azure_resource_set_hack.go#L94). This azure resource id is a hypothetic one, while we have to make sure it is of unique format. As Azure resource id will be used as the key in a lot of places.

@magodo
Copy link
Collaborator Author

magodo commented Sep 28, 2022

Per #238, the logic about discovering property-like resources are now offloaded to aztft. This helps to keep the code base clean and centralize all those azurerm provider resource specific details to aztft.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant