Drift-aware change sets were a great idea, but why does it want to update anything using !ImportValue?

I was experimenting with AWS’ new-ish drift-aware change-sets for CloudFormation to see how they work. I started with an existing stack that had a handful of resources, and one I had purposely drifted and another one, “PermissionsBoundary”, I made a change to in the template.

Without drift-awareness (i.e. the “old” way we’re all used to), it wanted to modify the one PermissionsBoundary resource that I had modified in the template. With drift-awareness, it wanted to modify the changed resource in the template and the resource that I had drifted (yay!) but it also wanted to modify several other resources. What’s even more strange is that drift-aware change sets show you which resources have drifted, and it indicated that these had not (see the images). When I examined the changes it was going to make, I saw a bunch of “changeset:KNOWN_AFTER_APPLY” values where the template was using !ImportValue.

What baffles me is I thought that values exported from other stacks cannot be changed if they’re being imported by other stacks. So, if this stack already is importing a value and the new template continues to import it, the value cannot change.

I was really hoping that drift-awareness was going to give us something more like ‘terraform plan’, but, with it flagging anything using !importValue like this, it makes it almost not worth using.

Does anybody know of a way to disable that behavior? Or maybe shed some light on why they made it work like this?


Related discussions:

New – AWS CloudFormation Designer + Support for More Services
Best way to setup app db user in RDS?
What tools do you all use with your cloudformation templates? Anything?
How to give access to ec2 instance to provision a cloudformation stack ?
Were there any changes to EC2 instance startup today?
Best practice setting up Auto Scaling groups
Cloudformation for Aurora Serverless?
CloudFormation now supports SSM Secure String Parameters
Serverless Image Handler
Introducing AWS CloudFormation Macros
Whatever happened to CloudFormation Drift Detection?
A project to help generate CloudFormation or AWS CLI scripts for security configurations
Heads up: it looks like CloudFormation finally supports fixed responses and redirects (e.g. HTTP -> HTTPS) for ALBs!
AWS CloudFormation, Swagger, and Broken Dreams
Redirect http to https with ALB via CloudFormation - Feature request
CloudFormation - can I set up SSH key based authentication with authorized_keys file between new EC2 resources?
auto scaling policy: how to get more control over the cloudwatch alarms?
Best way to reverse engineer an AWS stack?
AWS Backup Now Supports AWS CloudFormation
This custom domain name cannot map to WEBSOCKET protocol Apis
IAM issue - allowing Codepipeline to deploy to a Cloudformation template
Accessing multiple APIs from the same base URL
Best Practices for CloudFormation/Serverless
AWS Landing zone 2.4.0
CloudFormation: Import S3 Bucket Resource into another Stack
Can a cloudformation template roll back once complete?
Deploy CloudFormation Stacks concurrently across multiple AWS regions using AWS CloudFormation StackSets
Four ways of writing infrastructure-as-code on AWS
AWS CloudFormation introduces the option to troubleshoot provisioning errors before rollback, accelerating deployments
How to manage ECS Clusters accross accounts?
CDK not configuring CloudFront to use S3 Static Website origin domain even though bucket is configured as static website?
AWS Proton
Struggling to understand the differences between a Cloudformation stack and template - can anyone explain like I'm 5?
We need to stop saying "don't provide a name for resources in CDK/Cloudformation and let cloudformation name it", Its terrible....
Reshape your AWS CloudFormation stacks seamlessly with stack refactoring - AWS
How do I "export" my manually configure infrastructure into IaC
Using Python to do multi-account CloudFormation
Our Journey Tackling Cross-Account References in AWS CDK
Is there an API Gateway Cloudformation resource for custom domain + custom client certificate?
Cloudformation Autoscaling group name help
DevOps Done Right - Room Key's Datomic Deployment in AWS
AWS and Windows

terraform plan fetches any inputs that depend on data blocks - !ImportValue is the equivalent of a terraform_remote_state data source ; so perhaps this is an apples / oranges comparison, because CF isn’t fetching the exported values until you actually apply the changeset, versus Terraform which does all this at the plan stage (and allows you to export the entire plan and apply it later without further reference to data sources).

I thought that values exported from other stacks cannot be changed if they’re being imported by other stacks

Is this the case, or is it only that you can’t change their names or remove them from the stack? (I confess, I don’t have any handy CF stacksets to play with).

I also noticed that this feature cannot work with false-positive drifts. For example, if a false-positive drift thinks a resource is deleted, it will try to recreate the resource even if it still exists. I personally don’t recommend using it until AWS decides to fix drift detection.

This bit me too. From what I can tell, drift aware change sets treat !ImportValue as opaque at plan time, so they cannot prove the value is unchanged even if the export is effectively immutable while in use. That’s why you see KNOWN_AFTER_APPLY and a proposed update even though nothing will really change. It feels less like a real diff and more like CloudFormation being conservative because it cannot resolve the dependency graph across stacks. I do not think there is a way to disable that behavior today. The only workaround I have seen is minimizing ImportValue usage for things that should never trigger updates, or just mentally filtering those changes out and trusting no-op updates, which is not very satisfying.