-
Notifications
You must be signed in to change notification settings - Fork 5
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
fix: Update Team Resource #93
fix: Update Team Resource #93
Conversation
Unless you update the import logic to include the name, similar to the following:
|
If that's the case wouldn't all of the resource's attributes (minus the two being applied in the Import function) be proposed changes in a plan/apply after import? Or is there some scenario where it doesn't reconcile against the imported state in this case? |
I must be just misunderstanding something then. Let me explain what I'm seeing on the end-user side of things and maybe we can figure out what I'm missing. Given the following code: resource "terrakube_team" "example" {
name = "[email protected]"
organization_id = terrakube_organization.example.id
manage_state = true
manage_workspace = true
manage_module = true
manage_provider = true
manage_vcs = true
manage_template = true
manage_job = true
manage_collection = true
}
import {
to = terrakube_team.example
id = "org_id,team_id"
} I had this plan output
Now, my expectation is that b842f39 and/or a4bc965 will resolve the problem of
What you appear to be suggesting is that with the inclusion of 9cc8a77, I'll instead see a plan output suggesting that the team will need to be replaced, but I don't understand how that will be the case. If the name attribute is unchanged from state, which it would be if my original fixes were correct, then TF shouldn't see a need to replace the resource. If TF wasn't reading the resource's full attributes at some point between the import and the plan generation, then shouldn't it be proposing changes to the various |
It is working correctly I just tested it user@pop-os:~/git/terraform-provider-terrakube/examples/full$ terraform apply
terrakube_team.team: Preparing import... [id=d9b58bd3-f3fc-4056-a026-1163297e80a8,5b89f40f-80d5-4267-a781-6367e04d5b5c]
terrakube_team.team: Refreshing state... [id=5b89f40f-80d5-4267-a781-6367e04d5b5c]
Terraform will perform the following actions:
# terrakube_team.team will be imported
resource "terrakube_team" "team" {
id = "5b89f40f-80d5-4267-a781-6367e04d5b5c"
manage_collection = false
manage_job = false
manage_module = false
manage_provider = false
manage_state = false
manage_template = false
manage_vcs = false
manage_workspace = false
name = "TERRAKUBE_SUPER_ADMIN"
organization_id = "d9b58bd3-f3fc-4056-a026-1163297e80a8"
}
Plan: 1 to import, 0 to add, 0 to change, 0 to destroy.
╷
│ Warning: WARNING
│
│ with provider["registry.terraform.io/alfespa17/terrakube"],
│ on main.tf line 9, in provider "terrakube":
│ 9: provider "terrakube" {
│
│ In its current implementation, Terrakube creates one webhook for each instance of this resource and github has a default limitation of 20 webhooks per repository.
│
│ (and one more similar warning elsewhere)
╵
Do you want to perform these actions?
Terraform will perform the actions described above.
Only 'yes' will be accepted to approve.
Enter a value: yes
terrakube_team.team: Importing... [id=d9b58bd3-f3fc-4056-a026-1163297e80a8,5b89f40f-80d5-4267-a781-6367e04d5b5c]
terrakube_team.team: Import complete [id=d9b58bd3-f3fc-4056-a026-1163297e80a8,5b89f40f-80d5-4267-a781-6367e04d5b5c]
Apply complete! Resources: 1 imported, 0 added, 0 changed, 0 destroyed. When I run the plan again it is showing user@pop-os:~/git/terraform-provider-terrakube/examples/full$ terraform plan
terrakube_team.team: Refreshing state... [id=5b89f40f-80d5-4267-a781-6367e04d5b5c]
No changes. Your infrastructure matches the configuration.
Terraform has compared your real infrastructure against your configuration and found no differences, so no changes are needed.
╷
│ Warning: WARNING
│
│ with provider["registry.terraform.io/alfespa17/terrakube"],
│ on main.tf line 9, in provider "terrakube":
│ 9: provider "terrakube" {
│
│ In its current implementation, Terrakube creates one webhook for each instance of this resource and github has a default limitation of 20 webhooks per repository.
│
│ (and one more similar warning elsewhere)
|
Proposed fixes for #92:
Read()
Update()
Additional related Enhancement:
Caveat
I don't have an effective way to test this at the moment and I don't have much functional experience with writing Terraform providers, so if something looks like a mistake, it probably is.