hashicorp / hashicorp/terraform-plugin-sdk

GCP authorized_networks block shows as modified in plan even though no visible change is indicated

Open
#162 1 comment 0 reactions 0 assignees View on GitHub
enhancement subsystem/types terraform-plugin-framework
Dominant language
Go
Stars
485
Forks
244
Avg merge
19h 57m
Merged PRs (30d)
4

Description

### Current Terraform Version
```
Terraform v0.12.1
```

### Use-cases
Ever since v0.12, `terraform plan` and `terraform apply` no longer output a compact execution plan. Now, even a small change would list all resource property. Example, changing GCP SQL whitelisted IP now output:
```
~ settings {
activation_policy = "ALWAYS"
authorized_gae_applications = []
crash_safe_replication = false
disk_autoresize = true
disk_size = 10
disk_type = "PD_SSD"
pricing_plan = "PER_USE"
replication_type = "SYNCHRONOUS"
tier = "db-n1-standard-1"
user_labels = {}
version = 25

backup_configuration {
binary_log_enabled = true
enabled = true
start_time = "12:00"
}

~ ip_configuration {
ipv4_enabled = true
require_ssl = false

- authorized_networks {
- name = "other" -> null
- value = "10.0.0.1" -> null
}
- authorized_networks {
- name = "change-a" -> null
- value = "10.0.0.2" -> null
}
+ authorized_networks {
+ name = "change-b"
+ value = "10.0.0.2"
}
+ authorized_networks {
+ name = "other"
+ value = "10.0.0.1"
}
}

location_preference {
zone = "asia-southeast1-b"
}
}
```

"other" authorized networks doesn't need to be recreated. Properties like `location_preference` is not even changed.

### Proposal
Just show changed properties. If it's deletion then show it as deletion (with `-`).
```
~ settings {
~ ip_configuration {
~ authorized_networks {
~ name = "change-a" -> "change-b"
}
}
}
```

Contributor guide

Open the contributing guide

Research direction

Reproduce the authorized_networks plan behavior with Terraform v0.12.1, then trace the Terraform Plugin SDK's nested authorized_networks diff handling. Compare the generated plan with the proposal: unchanged entries should not appear as recreated, and a renamed entry should show only the changed property.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, terraform
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.