Created
January 19, 2024 13:48
-
-
Save Yamini-crypto/75c58c69980a3b92cead6684ccbaeb78 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
terraform refresh | |
# setting variables for auto scaling groups and policies location in state file | |
asg_location=module.asg.aws_autoscaling_group.id[0] | |
# checking the status of asgs in terraform state if there are changes then the new asg will be imported in place of that | |
# importing the updates in asg | |
terraform state show $asg_location | grep $(terraform output -raw asg_name) > /dev/null 2>&1 | |
if [ $? != 0 ] | |
then | |
terraform state rm $asg_location | |
terraform import $asg_location $(terraform output -raw asg_name) | |
terraform refresh | |
terraform state rm 'module.asg.aws_autoscaling_policy.this["dynamic_TTS_policy"]' | |
terraform import 'module.asg.aws_autoscaling_policy.this["dynamic_TTS_policy"]' $(terraform output -raw asg_name)/dynamic_TTS_policy | |
echo "updated asg" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment