Adding count = data.external.check_repo.result.success == "true" ? 0 : 1 fails as well … Is there a way to have “loop” resource which “call” the “aws_ecr_repository” ? Any other way ?
@jamiekt, trying to do that when the resource does not exist can cause terraform to alternately create then destroy the resource in many cases. Some situations may allow you to filter the data source such that the new resource would not show up in the next run, but that’s not universally true.
This is similar to the request to conditionally import a resource, but there is currently no way to handle either type of configuration in a general way.