@@ -40,18 +40,17 @@ func dataSourceAwsEcrRepositoryRead(d *schema.ResourceData, meta interface{}) er
4040 conn := meta .(* AWSClient ).ecrconn
4141 ignoreTagsConfig := meta .(* AWSClient ).IgnoreTagsConfig
4242
43+ name := d .Get ("name" ).(string )
4344 params := & ecr.DescribeRepositoriesInput {
44- RepositoryNames : aws .StringSlice ([]string {d . Get ( " name" ).( string ) }),
45+ RepositoryNames : aws .StringSlice ([]string {name }),
4546 }
4647 log .Printf ("[DEBUG] Reading ECR repository: %s" , params )
4748 out , err := conn .DescribeRepositories (params )
4849 if err != nil {
4950 if isAWSErr (err , ecr .ErrCodeRepositoryNotFoundException , "" ) {
50- log .Printf ("[WARN] ECR Repository %s not found, removing from state" , d .Id ())
51- d .SetId ("" )
52- return nil
51+ return fmt .Errorf ("ECR Repository (%s) not found" , name )
5352 }
54- return fmt .Errorf ("error reading ECR repository: %s " , err )
53+ return fmt .Errorf ("error reading ECR repository: %w " , err )
5554 }
5655
5756 repository := out .Repositories [0 ]
@@ -66,11 +65,11 @@ func dataSourceAwsEcrRepositoryRead(d *schema.ResourceData, meta interface{}) er
6665 tags , err := keyvaluetags .EcrListTags (conn , arn )
6766
6867 if err != nil {
69- return fmt .Errorf ("error listing tags for ECR Repository (%s): %s " , arn , err )
68+ return fmt .Errorf ("error listing tags for ECR Repository (%s): %w " , arn , err )
7069 }
7170
7271 if err := d .Set ("tags" , tags .IgnoreAws ().IgnoreConfig (ignoreTagsConfig ).Map ()); err != nil {
73- return fmt .Errorf ("error setting tags: %s " , err )
72+ return fmt .Errorf ("error setting tags: %w " , err )
7473 }
7574
7675 return nil
0 commit comments