Providers are plugins in Terraform CLI which interact with remote systems. It is the remote systems that create and maintain the actual infrastructure components corresponding to the resources defined in Terraform configuration files. In a common scenario, a resource that is implemented by a provider makes an API call to the remote system in order to create or update the actual infrastructure and subsequently read back the details of the newly created resource or the updated resource for Terraform to store in the information of the resource in the state file.
When a resource is created or updated on the remote backend, there are chances for a temporary condition to occur where the remote system is not operating fast enough to persist the information of the newly created resource or the updated resource into the storage for the subsequent read operation to retrieve the information of the resource accurately, however, the information will be eventually consistent. There are resources that have been implemented with extra logic to retry with the read operation, unfortunately, not all the available resources are implemented with the retry logic therefore the error message below may display at the end of the output of the failed run.
Error: Provider produced inconsistent result after apply When applying changes to module.base_network_security.module.nacl_rules_web["subnet-097561b568e98c04e"].aws_network_acl_rule.tcp_443_egress_ipv6_allow, provider "registry.terraform.io/hashicorp/aws" produced an unexpected new value: Root resource was present, but now absent.
The most appropriate solution for the symptom is raising Github issue to report the symptom to the maintainers of the provider. These following workarounds can be considered while the maintainers are working on the issue:
1) Manually deleting the resource that is reported in the error message on the remote system and rerun the apply operation, this method is suitable for users who have direct access to the remote systems.
2) Follow the How to Import Resources into a Remote State Managed by Terraform Cloud to perform
terraform import command to import the resource from the remote system into the state file and rerun the apply operation.
If you continue to experience the issues after following the guides, please contact HashiCorp Support to request for further assistance.