diff --git a/builtin/providers/aws/autoscaling_tags.go b/builtin/providers/aws/autoscaling_tags.go index e9ca8531a..0ca063598 100644 --- a/builtin/providers/aws/autoscaling_tags.go +++ b/builtin/providers/aws/autoscaling_tags.go @@ -190,7 +190,7 @@ func setToMapByKey(s *schema.Set, key string) map[string]interface{} { // compare a tag against a list of strings and checks if it should // be ignored or not func tagIgnoredAutoscaling(t *autoscaling.Tag) bool { - filter := []string{"^aws:*"} + filter := []string{"^aws:"} for _, v := range filter { log.Printf("[DEBUG] Matching %v with %v\n", v, *t.Key) if r, _ := regexp.MatchString(v, *t.Key); r == true { diff --git a/builtin/providers/aws/s3_tags.go b/builtin/providers/aws/s3_tags.go index 696821b79..f691cff46 100644 --- a/builtin/providers/aws/s3_tags.go +++ b/builtin/providers/aws/s3_tags.go @@ -121,7 +121,7 @@ func getTagSetS3(s3conn *s3.S3, bucket string) ([]*s3.Tag, error) { // compare a tag against a list of strings and checks if it should // be ignored or not func tagIgnoredS3(t *s3.Tag) bool { - filter := []string{"^aws:*"} + filter := []string{"^aws:"} for _, v := range filter { log.Printf("[DEBUG] Matching %v with %v\n", v, *t.Key) if r, _ := regexp.MatchString(v, *t.Key); r == true { diff --git a/builtin/providers/aws/s3_tags_test.go b/builtin/providers/aws/s3_tags_test.go index 48d38b715..42d5b605d 100644 --- a/builtin/providers/aws/s3_tags_test.go +++ b/builtin/providers/aws/s3_tags_test.go @@ -1,14 +1,11 @@ package aws import ( - "fmt" "reflect" "testing" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/s3" - "github.com/hashicorp/terraform/helper/resource" - "github.com/hashicorp/terraform/terraform" ) func TestDiffTagsS3(t *testing.T) { @@ -78,26 +75,3 @@ func TestIgnoringTagsS3(t *testing.T) { } } } - -// testAccCheckTags can be used to check the tags on a resource. -func testAccCheckTagsS3( - ts *[]*s3.Tag, key string, value string) resource.TestCheckFunc { - return func(s *terraform.State) error { - m := tagsToMapS3(*ts) - v, ok := m[key] - if value != "" && !ok { - return fmt.Errorf("Missing tag: %s", key) - } else if value == "" && ok { - return fmt.Errorf("Extra tag: %s", key) - } - if value == "" { - return nil - } - - if v != value { - return fmt.Errorf("%s: bad value: %s", key, v) - } - - return nil - } -} diff --git a/builtin/providers/aws/tags.go b/builtin/providers/aws/tags.go index 57a8f6ab0..4d9d54480 100644 --- a/builtin/providers/aws/tags.go +++ b/builtin/providers/aws/tags.go @@ -282,7 +282,7 @@ func tagsFromMapELBv2(m map[string]interface{}) []*elbv2.Tag { // tagIgnored compares a tag against a list of strings and checks if it should // be ignored or not func tagIgnored(t *ec2.Tag) bool { - filter := []string{"^aws:*"} + filter := []string{"^aws:"} for _, v := range filter { log.Printf("[DEBUG] Matching %v with %v\n", v, *t.Key) if r, _ := regexp.MatchString(v, *t.Key); r == true { @@ -295,7 +295,7 @@ func tagIgnored(t *ec2.Tag) bool { // and for ELBv2 as well func tagIgnoredELBv2(t *elbv2.Tag) bool { - filter := []string{"^aws:*"} + filter := []string{"^aws:"} for _, v := range filter { log.Printf("[DEBUG] Matching %v with %v\n", v, *t.Key) if r, _ := regexp.MatchString(v, *t.Key); r == true { diff --git a/builtin/providers/aws/tagsBeanstalk.go b/builtin/providers/aws/tagsBeanstalk.go index c3b7b95da..7b85d6116 100644 --- a/builtin/providers/aws/tagsBeanstalk.go +++ b/builtin/providers/aws/tagsBeanstalk.go @@ -62,7 +62,7 @@ func tagsToMapBeanstalk(ts []*elasticbeanstalk.Tag) map[string]string { // compare a tag against a list of strings and checks if it should // be ignored or not func tagIgnoredBeanstalk(t *elasticbeanstalk.Tag) bool { - filter := []string{"^aws:*"} + filter := []string{"^aws:"} for _, v := range filter { log.Printf("[DEBUG] Matching %v with %v\n", v, *t.Key) if r, _ := regexp.MatchString(v, *t.Key); r == true { diff --git a/builtin/providers/aws/tagsCloudtrail.go b/builtin/providers/aws/tagsCloudtrail.go index 020a6ea92..b4302ddd1 100644 --- a/builtin/providers/aws/tagsCloudtrail.go +++ b/builtin/providers/aws/tagsCloudtrail.go @@ -100,7 +100,7 @@ func tagsToMapCloudtrail(ts []*cloudtrail.Tag) map[string]string { // compare a tag against a list of strings and checks if it should // be ignored or not func tagIgnoredCloudtrail(t *cloudtrail.Tag) bool { - filter := []string{"^aws:*"} + filter := []string{"^aws:"} for _, v := range filter { log.Printf("[DEBUG] Matching %v with %v\n", v, *t.Key) if r, _ := regexp.MatchString(v, *t.Key); r == true { diff --git a/builtin/providers/aws/tagsCodeBuild.go b/builtin/providers/aws/tagsCodeBuild.go index e28fc2146..3302d7426 100644 --- a/builtin/providers/aws/tagsCodeBuild.go +++ b/builtin/providers/aws/tagsCodeBuild.go @@ -55,7 +55,7 @@ func tagsToMapCodeBuild(ts []*codebuild.Tag) map[string]string { // compare a tag against a list of strings and checks if it should // be ignored or not func tagIgnoredCodeBuild(t *codebuild.Tag) bool { - filter := []string{"^aws:*"} + filter := []string{"^aws:"} for _, v := range filter { log.Printf("[DEBUG] Matching %v with %v\n", v, *t.Key) if r, _ := regexp.MatchString(v, *t.Key); r == true { diff --git a/builtin/providers/aws/tagsEC.go b/builtin/providers/aws/tagsEC.go index 6b29057ad..b9b22af9c 100644 --- a/builtin/providers/aws/tagsEC.go +++ b/builtin/providers/aws/tagsEC.go @@ -103,7 +103,7 @@ func tagsToMapEC(ts []*elasticache.Tag) map[string]string { // compare a tag against a list of strings and checks if it should // be ignored or not func tagIgnoredEC(t *elasticache.Tag) bool { - filter := []string{"^aws:*"} + filter := []string{"^aws:"} for _, v := range filter { log.Printf("[DEBUG] Matching %v with %v\n", v, *t.Key) if r, _ := regexp.MatchString(v, *t.Key); r == true { diff --git a/builtin/providers/aws/tagsEFS.go b/builtin/providers/aws/tagsEFS.go index 2dc6189cc..b61973165 100644 --- a/builtin/providers/aws/tagsEFS.go +++ b/builtin/providers/aws/tagsEFS.go @@ -102,7 +102,7 @@ func tagsToMapEFS(ts []*efs.Tag) map[string]string { // compare a tag against a list of strings and checks if it should // be ignored or not func tagIgnoredEFS(t *efs.Tag) bool { - filter := []string{"^aws:*"} + filter := []string{"^aws:"} for _, v := range filter { log.Printf("[DEBUG] Matching %v with %v\n", v, *t.Key) if r, _ := regexp.MatchString(v, *t.Key); r == true { diff --git a/builtin/providers/aws/tagsELB.go b/builtin/providers/aws/tagsELB.go index 4c177b878..081de9cc1 100644 --- a/builtin/providers/aws/tagsELB.go +++ b/builtin/providers/aws/tagsELB.go @@ -102,7 +102,7 @@ func tagsToMapELB(ts []*elb.Tag) map[string]string { // compare a tag against a list of strings and checks if it should // be ignored or not func tagIgnoredELB(t *elb.Tag) bool { - filter := []string{"^aws:*"} + filter := []string{"^aws:"} for _, v := range filter { log.Printf("[DEBUG] Matching %v with %v\n", v, *t.Key) if r, _ := regexp.MatchString(v, *t.Key); r == true { diff --git a/builtin/providers/aws/tagsGeneric.go b/builtin/providers/aws/tagsGeneric.go index 08bba6756..d494a4972 100644 --- a/builtin/providers/aws/tagsGeneric.go +++ b/builtin/providers/aws/tagsGeneric.go @@ -57,7 +57,7 @@ func tagsToMapGeneric(ts map[string]*string) map[string]string { // compare a tag against a list of strings and checks if it should // be ignored or not func tagIgnoredGeneric(k string) bool { - filter := []string{"^aws:*"} + filter := []string{"^aws:"} for _, v := range filter { log.Printf("[DEBUG] Matching %v with %v\n", v, k) if r, _ := regexp.MatchString(v, k); r == true { diff --git a/builtin/providers/aws/tagsInspector.go b/builtin/providers/aws/tagsInspector.go index f846319f9..ef18f33c2 100644 --- a/builtin/providers/aws/tagsInspector.go +++ b/builtin/providers/aws/tagsInspector.go @@ -62,7 +62,7 @@ func tagsToMapInspector(ts []*inspector.ResourceGroupTag) map[string]string { // compare a tag against a list of strings and checks if it should // be ignored or not func tagIgnoredInspector(t *inspector.ResourceGroupTag) bool { - filter := []string{"^aws:*"} + filter := []string{"^aws:"} for _, v := range filter { log.Printf("[DEBUG] Matching %v with %v\n", v, *t.Key) if r, _ := regexp.MatchString(v, *t.Key); r == true { diff --git a/builtin/providers/aws/tagsKMS.go b/builtin/providers/aws/tagsKMS.go index d4d2eca1c..4e918414e 100644 --- a/builtin/providers/aws/tagsKMS.go +++ b/builtin/providers/aws/tagsKMS.go @@ -103,7 +103,7 @@ func tagsToMapKMS(ts []*kms.Tag) map[string]string { // compare a tag against a list of strings and checks if it should // be ignored or not func tagIgnoredKMS(t *kms.Tag) bool { - filter := []string{"^aws:*"} + filter := []string{"^aws:"} for _, v := range filter { log.Printf("[DEBUG] Matching %v with %v\n", v, *t.TagKey) if r, _ := regexp.MatchString(v, *t.TagKey); r == true { diff --git a/builtin/providers/aws/tagsRDS.go b/builtin/providers/aws/tagsRDS.go index 1a5b0c1c7..2d6411348 100644 --- a/builtin/providers/aws/tagsRDS.go +++ b/builtin/providers/aws/tagsRDS.go @@ -121,7 +121,7 @@ func saveTagsRDS(conn *rds.RDS, d *schema.ResourceData, arn string) error { // compare a tag against a list of strings and checks if it should // be ignored or not func tagIgnoredRDS(t *rds.Tag) bool { - filter := []string{"^aws:*"} + filter := []string{"^aws:"} for _, v := range filter { log.Printf("[DEBUG] Matching %v with %v\n", v, *t.Key) if r, _ := regexp.MatchString(v, *t.Key); r == true { diff --git a/builtin/providers/aws/tagsRedshift.go b/builtin/providers/aws/tagsRedshift.go index 0a87f7114..715e82045 100644 --- a/builtin/providers/aws/tagsRedshift.go +++ b/builtin/providers/aws/tagsRedshift.go @@ -96,7 +96,7 @@ func tagsToMapRedshift(ts []*redshift.Tag) map[string]string { // compare a tag against a list of strings and checks if it should // be ignored or not func tagIgnoredRedshift(t *redshift.Tag) bool { - filter := []string{"^aws:*"} + filter := []string{"^aws:"} for _, v := range filter { log.Printf("[DEBUG] Matching %v with %v\n", v, *t.Key) if r, _ := regexp.MatchString(v, *t.Key); r == true { diff --git a/builtin/providers/aws/tags_elasticsearchservice.go b/builtin/providers/aws/tags_elasticsearchservice.go index f048e4681..e585d1afa 100644 --- a/builtin/providers/aws/tags_elasticsearchservice.go +++ b/builtin/providers/aws/tags_elasticsearchservice.go @@ -102,7 +102,7 @@ func tagsToMapElasticsearchService(ts []*elasticsearch.Tag) map[string]string { // compare a tag against a list of strings and checks if it should // be ignored or not func tagIgnoredElasticsearchService(t *elasticsearch.Tag) bool { - filter := []string{"^aws:*"} + filter := []string{"^aws:"} for _, v := range filter { log.Printf("[DEBUG] Matching %v with %v\n", v, *t.Key) if r, _ := regexp.MatchString(v, *t.Key); r == true { diff --git a/builtin/providers/aws/tags_kinesis.go b/builtin/providers/aws/tags_kinesis.go index 5c5935988..a5622e95d 100644 --- a/builtin/providers/aws/tags_kinesis.go +++ b/builtin/providers/aws/tags_kinesis.go @@ -113,7 +113,7 @@ func tagsToMapKinesis(ts []*kinesis.Tag) map[string]string { // compare a tag against a list of strings and checks if it should // be ignored or not func tagIgnoredKinesis(t *kinesis.Tag) bool { - filter := []string{"^aws:*"} + filter := []string{"^aws:"} for _, v := range filter { log.Printf("[DEBUG] Matching %v with %v\n", v, *t.Key) if r, _ := regexp.MatchString(v, *t.Key); r == true { diff --git a/builtin/providers/aws/tags_route53.go b/builtin/providers/aws/tags_route53.go index d675f42e0..372167291 100644 --- a/builtin/providers/aws/tags_route53.go +++ b/builtin/providers/aws/tags_route53.go @@ -99,7 +99,7 @@ func tagsToMapR53(ts []*route53.Tag) map[string]string { // compare a tag against a list of strings and checks if it should // be ignored or not func tagIgnoredRoute53(t *route53.Tag) bool { - filter := []string{"^aws:*"} + filter := []string{"^aws:"} for _, v := range filter { log.Printf("[DEBUG] Matching %v with %v\n", v, *t.Key) if r, _ := regexp.MatchString(v, *t.Key); r == true {