You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
If you are interested in working on this issue or have submitted a pull request, please leave a comment
The resources and data sources in this provider are generated from the CloudFormation schema, so they can only support the actions that the underlying schema supports. For this reason submitted bugs should be limited to defects in the generation and runtime code of the provider. Customizing behavior of the resource, or noting a gap in behavior are not valid bugs and should be submitted as enhancements to AWS via the CloudFormation Open Coverage Roadmap.
Terraform CLI and Terraform AWS Cloud Control Provider Version
terraform {
required_providers {
awscc={
source ="hashicorp/awscc"
version ="~> 1.30.0"
}
}
}
provider"awscc" {
region="ap-northeast-1"
}
# Any data sources that retrieves resources not exist in the target AWS account.data"awscc_amplify_apps""all" {}
Debug Output
Panic Output
Expected Behavior
A data source that returns multiple resources will return an empty list if the target resource does not exist.
For example, in the case of the aws provider, it behaves as follows:
# Any data sources that retrieves resources not exist in the target AWS account.data"aws_db_instances""all" {}
output"aws_db_instances" {
value=data.aws_db_instances.all
}
❯ terraform apply --auto-approve
data.aws_db_instances.all: Reading...
data.aws_db_instances.all: Read complete after 0s [id=ap-northeast-1]
Changes to Outputs:
+ aws_db_instances = {
+ filter = null
+ id = "ap-northeast-1"
+ instance_arns = []
+ instance_identifiers = []
+ tags = null
}
You can apply this plan to save these new output values to the Terraform state, without changing any real infrastructure.
Apply complete! Resources: 0 added, 0 changed, 0 destroyed.
Outputs:
aws_instances = {
"filter" = toset(null) /* of object */
"id" = "ap-northeast-1""instance_arns" = tolist([])
"instance_identifiers" = tolist([])
"tags" = tomap(null) /* of string */
}
Actual Behavior
If the data source's target does not exist in the target AWS account, it will result in an error.
So it is not possible to use the data resource's results for conditional branching.
❯ terraform apply
data.awscc_amplify_apps.all: Reading...
╷
│ Error: AWS SDK Go Service Operation Unsuccessful
│
│ with data.awscc_amplify_apps.all,
│ on terraform.tf line 5, in data "awscc_amplify_apps""all":
│ 5: data "awscc_amplify_apps""all" {}
│
│ Calling CloudControl service ListResources operation returned: Empty result
Community Note
Terraform CLI and Terraform AWS Cloud Control Provider Version
Affected Resource(s)
data.awscc_xxxxxs
All data sources which return list.
Terraform Configuration Files
Debug Output
Panic Output
Expected Behavior
A data source that returns multiple resources will return an empty list if the target resource does not exist.
For example, in the case of the aws provider, it behaves as follows:
Actual Behavior
If the data source's target does not exist in the target AWS account, it will result in an error.
So it is not possible to use the data resource's results for conditional branching.
Steps to Reproduce
terraform plan
Important Factoids
References
The text was updated successfully, but these errors were encountered: