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

Resource mapping file will now be generated together with the import.tf that is the TF plannable import blocks #398

Merged
merged 3 commits into from
Jun 15, 2023

Conversation

magodo
Copy link
Collaborator

@magodo magodo commented May 16, 2023

The -g and s generates both a JSON versioned resource mapping file and the import.tf that is the new TF plannable import blocks, e.g.

>  cat import.tf
import {
  id = "/subscriptions/xxxx/resourceGroups/AZTFY-VMDISK/providers/Microsoft.Compute/virtualMachines/aztfy-test/extensions/Microsoft.Azure.Monitor.AzureMonitorLinuxAgent"
  to = azurerm_virtual_machine_extension.res-0
}
import {
  id = "/subscriptions/xxxx/resourceGroups/AZTFY-VMDISK/providers/Microsoft.Compute/virtualMachines/aztfy-test/extensions/Microsoft.Azure.Security.Monitoring.AzureSecurityLinuxAgent"
  to = azurerm_virtual_machine_extension.res-1
}

#...

Users are welcome to grab the import.tf and proceed the plannable import process for another importing experience that is provided by TF official.

This behavior only takes effect when the terraform under used is >= v1.5.0.

The generated import.tf is not really working, see: hashicorp/terraform#33201

@stemaMSFT The document in MS Doc needs to be updated once this PR is merged...

@magodo magodo added the enhancement New feature or request label May 16, 2023
@magodo magodo marked this pull request as ready for review May 25, 2023 02:06
@magodo magodo requested a review from stemaMSFT May 25, 2023 02:06
@magodo magodo marked this pull request as draft May 25, 2023 02:08
Copy link
Member

@stemaMSFT stemaMSFT left a comment

Choose a reason for hiding this comment

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

LGTM. Terraform 1.5 doesn't GA until July I believe, so I will need to talk to HashiCorp to get their thoughts on when exactly they believe it'd be ok for us to publish this update.

@magodo
Copy link
Collaborator Author

magodo commented Jun 15, 2023

@stemaMSFT Since Terraform v1.5 is published, shall we merge this PR now?

@stemaMSFT stemaMSFT merged commit 6f0926b into Azure:main Jun 15, 2023
@stemaMSFT
Copy link
Member

@magodo merged!

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 this pull request may close these issues.

2 participants