github.com/pbthorste/terraform@v0.8.6-0.20170127005045-deb56bd93da2/builtin/providers/aws/diff_suppress_funcs.go (about)

     1  package aws
     2  
     3  import (
     4  	"log"
     5  	"strings"
     6  
     7  	"github.com/hashicorp/terraform/helper/schema"
     8  	"github.com/jen20/awspolicyequivalence"
     9  )
    10  
    11  func suppressEquivalentAwsPolicyDiffs(k, old, new string, d *schema.ResourceData) bool {
    12  	equivalent, err := awspolicy.PoliciesAreEquivalent(old, new)
    13  	if err != nil {
    14  		return false
    15  	}
    16  
    17  	return equivalent
    18  }
    19  
    20  // Suppresses minor version changes to the db_instance engine_version attribute
    21  func suppressAwsDbEngineVersionDiffs(k, old, new string, d *schema.ResourceData) bool {
    22  	if d.Get("auto_minor_version_upgrade").(bool) {
    23  		// If we're set to auto upgrade minor versions
    24  		// ignore a minor version diff between versions
    25  		if strings.HasPrefix(old, new) {
    26  			log.Printf("[DEBUG] Ignoring minor version diff")
    27  			return true
    28  		}
    29  	}
    30  
    31  	// Throw a diff by default
    32  	return false
    33  }