This error occurs when Terraform successfully creates a resource but cannot verify its existence immediately after. The provider creates the resource but fails to read it back, causing Terraform to believe the resource disappeared.
This error indicates a provider bug or timing issue. When Terraform applies changes, the provider successfully creates a resource in the remote service but then fails to verify it exists when reading back the state. This can happen due to API delays, network timeouts, race conditions, or permission changes that occur during resource creation. The outer error "provider produced an unexpected new value" wraps the inner message "Root resource was present, but now absent", which comes from Terraform's state validation logic.
Before taking any action, confirm that the resource was actually created. Use the provider's web console, CLI, or API to check if the resource exists. Many times the resource is successfully created despite Terraform reporting an error.
Run terraform apply again. Often the issue is transient and a second apply will succeed, as the resource is now queryable. This is a common short-term workaround.
If the resource exists in the remote service, import it into your Terraform state:
terraform import <resource_type>.<resource_name> <resource_id>Then run terraform apply again. This tells Terraform to track an existing resource rather than creating a new one.
Check if your provider has a newer version that fixes this issue:
terraform init -upgradeMany of these errors have been fixed in recent provider updates. Update your provider constraint in your Terraform configuration to allow newer versions.
If the resource is not critical and already exists in the remote service, you can manually delete it and re-run terraform apply. This is only recommended for development/test environments, not production.
If creating multiple related resources, add depends_on statements to enforce creation order. This can help with timing issues:
resource "example_resource" "second" {
depends_on = [example_resource.first]
# ...
}Note: This doesn't always resolve the issue but can help with resource interdependencies.
This is typically a bug in the provider itself. Open an issue on the provider's GitHub repository with:
- Exact error message and stack trace
- Terraform version (terraform version)
- Provider version
- Minimal reproducible configuration
- Steps to reproduce
Include the remote resource ID and whether the resource actually exists after the error.
This error originates from Terraform's compatibility layer in compatible.go, which validates that resource changes are consistent. It's distinct from other "resource not found" errors because it specifically means the resource *was* present during creation but became absent during state refresh. This can indicate:
1. Resource lifecycle issues: Some resources have complex creation processes where access permissions change during creation (e.g., AWS resources with role assumption, Snowflake resources with ownership transfers)
2. Provider-specific quirks: Different providers handle resource creation verification differently. Some check too early, some have race conditions in their read logic.
3. API behavior: Some cloud APIs have eventual consistency delays. The resource exists but isn't queryable immediately after creation.
4. State file corruption: In rare cases, corrupted state can cause this. Verify your state file integrity if this happens repeatedly.
This error is NOT typically a Terraform core issue—it's almost always a provider-level bug that should be reported to the specific provider maintainers.
Error: Error installing helm release: cannot re-use a name that is still in use
How to fix "release name in use" error in Terraform with Helm
Error: Error creating GKE Cluster: BadRequest
BadRequest error creating GKE cluster in Terraform
Error: External program failed to produce valid JSON
External program failed to produce valid JSON
Error: Unsupported argument in child module call
How to fix "Unsupported argument in child module call" in Terraform
Error: network is unreachable
How to fix "network is unreachable" in Terraform