Hello,
I am trying to set up AWS AppConfig using terraform. To create a new hosted configuration version, I am using the aws_appconfig_hosted_configuration_version resource. For the first terraform apply, it works fine and creates configuration version 1 in the configuration profile.
Later on, in case of any changes in content, it destroys the v1 of configuration and recreates v1 with updated content.
Ideally it should create a new configuration version, where the version number gets incremented by 1, in case of a content update. Following is how I have defined the resource in IaC where I am using the file() function to get content that is stored locally.
Following are the apply logs when the configuration content got changed.
module.appconfig.aws_appconfig_application.application: Refreshing state... [id=app_id]
module.appconfig.aws_appconfig_deployment_strategy.strategy: Refreshing state... [id=deploy_strategy_id]
module.appconfig.aws_appconfig_environment.environment: Refreshing state... [id=env_id:app_id]
module.appconfig.aws_appconfig_configuration_profile.profile["test"]: Refreshing state... [id=config_profile_id:app_id]
module.appconfig.aws_appconfig_hosted_configuration_version.configuration["test"]: Refreshing state... [id=app_id/config_profile_id/1]
module.appconfig.aws_appconfig_hosted_configuration_version.configuration["test"]: Destroying... [id=app_id/config_profile_id/1]
module.appconfig.aws_appconfig_hosted_configuration_version.configuration["test"]: Destruction complete after 2s
module.appconfig.aws_appconfig_hosted_configuration_version.configuration["test"]: Creating...
module.appconfig.aws_appconfig_hosted_configuration_version.configuration["test"]: Creation complete after 3s [id=app_id/config_profile_id/1]
In the above logs, you can see that both the version(destroyed and recreated) are the same, i.e. 1.
Is there a way in Terraform to overcome this issue? Following are the versions that I am using.
Terraform - 0.14.10
AWS provider - 3.50.0