How to just create a new version of AWS Appconfig Configuration Profile every time a config file getting changed

I want to manage AWS appconfig via Terraform. But the problem I am facing is that terraform on every config change, it destroy/create the resource which config’s hosted configuration, which results in the same version. This is useless to anybody using Appconfig.


provider "aws" {
  region  = "ap-south-1"
  profile = "default"
}

# Create the AppConfig application
resource "aws_appconfig_application" "homepage" {
  name        = "homepage"
  description = "Homepage application configuration"
}

# Create the configuration profiles
# application.yml
resource "aws_appconfig_configuration_profile" "application" {
  application_id = aws_appconfig_application.homepage.id
  name           = "application"
  description    = "Application configuration profile"
  location_uri   = "hosted"
}

# http.yml
resource "aws_appconfig_configuration_profile" "http" {
  application_id = aws_appconfig_application.homepage.id
  name           = "http"
  description    = "HTTP configuration profile"
  location_uri   = "hosted"
}

# Create the environment
resource "aws_appconfig_environment" "uat" {
  application_id = aws_appconfig_application.homepage.id
  name           = "uat"
  description    = "UAT environment"
}

# Create the hosted configuration versions (assuming content is in local files)
resource "aws_appconfig_hosted_configuration_version" "application" {
  application_id           = aws_appconfig_application.homepage.id
  configuration_profile_id = aws_appconfig_configuration_profile.application.configuration_profile_id
  content                  = file("${path.module}/configs/application.yml")
  content_type             = "application/x-yaml"
  description              = "Application configuration version"
}

resource "aws_appconfig_hosted_configuration_version" "http" {
  application_id           = aws_appconfig_application.homepage.id
  configuration_profile_id = aws_appconfig_configuration_profile.http.configuration_profile_id
  content                  = file("${path.module}/configs/http.yml")
  content_type             = "application/x-yaml"
  description              = "HTTP configuration version"
}