provider/aws: Stop setting weight property on route53_record read (#12756)
Fixes: #12752 Weight was replaced with weighted_routing_policy in June 2016. But for some reason we were still doing the following in the Read func: ``` d.Set("weight", -1) ``` As this field was removed, we shouldn't be setting it to state
This commit is contained in:
parent
ead7a3758b
commit
98009ba733
|
@ -33,7 +33,7 @@ func resourceAwsRoute53Record() *schema.Resource {
|
||||||
SchemaVersion: 2,
|
SchemaVersion: 2,
|
||||||
MigrateState: resourceAwsRoute53RecordMigrateState,
|
MigrateState: resourceAwsRoute53RecordMigrateState,
|
||||||
Schema: map[string]*schema.Schema{
|
Schema: map[string]*schema.Schema{
|
||||||
"name": &schema.Schema{
|
"name": {
|
||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Required: true,
|
Required: true,
|
||||||
ForceNew: true,
|
ForceNew: true,
|
||||||
|
@ -43,18 +43,18 @@ func resourceAwsRoute53Record() *schema.Resource {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
"fqdn": &schema.Schema{
|
"fqdn": {
|
||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
},
|
},
|
||||||
|
|
||||||
"type": &schema.Schema{
|
"type": {
|
||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Required: true,
|
Required: true,
|
||||||
ValidateFunc: validateRoute53RecordType,
|
ValidateFunc: validateRoute53RecordType,
|
||||||
},
|
},
|
||||||
|
|
||||||
"zone_id": &schema.Schema{
|
"zone_id": {
|
||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Required: true,
|
Required: true,
|
||||||
ForceNew: true,
|
ForceNew: true,
|
||||||
|
@ -67,41 +67,41 @@ func resourceAwsRoute53Record() *schema.Resource {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
"ttl": &schema.Schema{
|
"ttl": {
|
||||||
Type: schema.TypeInt,
|
Type: schema.TypeInt,
|
||||||
Optional: true,
|
Optional: true,
|
||||||
ConflictsWith: []string{"alias"},
|
ConflictsWith: []string{"alias"},
|
||||||
},
|
},
|
||||||
|
|
||||||
"weight": &schema.Schema{
|
"weight": {
|
||||||
Type: schema.TypeInt,
|
Type: schema.TypeInt,
|
||||||
Optional: true,
|
Optional: true,
|
||||||
Removed: "Now implemented as weighted_routing_policy; Please see https://www.terraform.io/docs/providers/aws/r/route53_record.html",
|
Removed: "Now implemented as weighted_routing_policy; Please see https://www.terraform.io/docs/providers/aws/r/route53_record.html",
|
||||||
},
|
},
|
||||||
|
|
||||||
"set_identifier": &schema.Schema{
|
"set_identifier": {
|
||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Optional: true,
|
Optional: true,
|
||||||
},
|
},
|
||||||
|
|
||||||
"alias": &schema.Schema{
|
"alias": {
|
||||||
Type: schema.TypeSet,
|
Type: schema.TypeSet,
|
||||||
Optional: true,
|
Optional: true,
|
||||||
ConflictsWith: []string{"records", "ttl"},
|
ConflictsWith: []string{"records", "ttl"},
|
||||||
Elem: &schema.Resource{
|
Elem: &schema.Resource{
|
||||||
Schema: map[string]*schema.Schema{
|
Schema: map[string]*schema.Schema{
|
||||||
"zone_id": &schema.Schema{
|
"zone_id": {
|
||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Required: true,
|
Required: true,
|
||||||
},
|
},
|
||||||
|
|
||||||
"name": &schema.Schema{
|
"name": {
|
||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Required: true,
|
Required: true,
|
||||||
StateFunc: normalizeAwsAliasName,
|
StateFunc: normalizeAwsAliasName,
|
||||||
},
|
},
|
||||||
|
|
||||||
"evaluate_target_health": &schema.Schema{
|
"evaluate_target_health": {
|
||||||
Type: schema.TypeBool,
|
Type: schema.TypeBool,
|
||||||
Required: true,
|
Required: true,
|
||||||
},
|
},
|
||||||
|
@ -110,13 +110,13 @@ func resourceAwsRoute53Record() *schema.Resource {
|
||||||
Set: resourceAwsRoute53AliasRecordHash,
|
Set: resourceAwsRoute53AliasRecordHash,
|
||||||
},
|
},
|
||||||
|
|
||||||
"failover": &schema.Schema{ // PRIMARY | SECONDARY
|
"failover": { // PRIMARY | SECONDARY
|
||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Optional: true,
|
Optional: true,
|
||||||
Removed: "Now implemented as failover_routing_policy; see docs",
|
Removed: "Now implemented as failover_routing_policy; see docs",
|
||||||
},
|
},
|
||||||
|
|
||||||
"failover_routing_policy": &schema.Schema{
|
"failover_routing_policy": {
|
||||||
Type: schema.TypeList,
|
Type: schema.TypeList,
|
||||||
Optional: true,
|
Optional: true,
|
||||||
ConflictsWith: []string{
|
ConflictsWith: []string{
|
||||||
|
@ -126,7 +126,7 @@ func resourceAwsRoute53Record() *schema.Resource {
|
||||||
},
|
},
|
||||||
Elem: &schema.Resource{
|
Elem: &schema.Resource{
|
||||||
Schema: map[string]*schema.Schema{
|
Schema: map[string]*schema.Schema{
|
||||||
"type": &schema.Schema{
|
"type": {
|
||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Required: true,
|
Required: true,
|
||||||
ValidateFunc: func(v interface{}, k string) (ws []string, es []error) {
|
ValidateFunc: func(v interface{}, k string) (ws []string, es []error) {
|
||||||
|
@ -141,7 +141,7 @@ func resourceAwsRoute53Record() *schema.Resource {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
"latency_routing_policy": &schema.Schema{
|
"latency_routing_policy": {
|
||||||
Type: schema.TypeList,
|
Type: schema.TypeList,
|
||||||
Optional: true,
|
Optional: true,
|
||||||
ConflictsWith: []string{
|
ConflictsWith: []string{
|
||||||
|
@ -151,7 +151,7 @@ func resourceAwsRoute53Record() *schema.Resource {
|
||||||
},
|
},
|
||||||
Elem: &schema.Resource{
|
Elem: &schema.Resource{
|
||||||
Schema: map[string]*schema.Schema{
|
Schema: map[string]*schema.Schema{
|
||||||
"region": &schema.Schema{
|
"region": {
|
||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Required: true,
|
Required: true,
|
||||||
},
|
},
|
||||||
|
@ -159,7 +159,7 @@ func resourceAwsRoute53Record() *schema.Resource {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
"geolocation_routing_policy": &schema.Schema{ // AWS Geolocation
|
"geolocation_routing_policy": { // AWS Geolocation
|
||||||
Type: schema.TypeList,
|
Type: schema.TypeList,
|
||||||
Optional: true,
|
Optional: true,
|
||||||
ConflictsWith: []string{
|
ConflictsWith: []string{
|
||||||
|
@ -169,15 +169,15 @@ func resourceAwsRoute53Record() *schema.Resource {
|
||||||
},
|
},
|
||||||
Elem: &schema.Resource{
|
Elem: &schema.Resource{
|
||||||
Schema: map[string]*schema.Schema{
|
Schema: map[string]*schema.Schema{
|
||||||
"continent": &schema.Schema{
|
"continent": {
|
||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Optional: true,
|
Optional: true,
|
||||||
},
|
},
|
||||||
"country": &schema.Schema{
|
"country": {
|
||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Optional: true,
|
Optional: true,
|
||||||
},
|
},
|
||||||
"subdivision": &schema.Schema{
|
"subdivision": {
|
||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Optional: true,
|
Optional: true,
|
||||||
},
|
},
|
||||||
|
@ -185,7 +185,7 @@ func resourceAwsRoute53Record() *schema.Resource {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
"weighted_routing_policy": &schema.Schema{
|
"weighted_routing_policy": {
|
||||||
Type: schema.TypeList,
|
Type: schema.TypeList,
|
||||||
Optional: true,
|
Optional: true,
|
||||||
ConflictsWith: []string{
|
ConflictsWith: []string{
|
||||||
|
@ -195,7 +195,7 @@ func resourceAwsRoute53Record() *schema.Resource {
|
||||||
},
|
},
|
||||||
Elem: &schema.Resource{
|
Elem: &schema.Resource{
|
||||||
Schema: map[string]*schema.Schema{
|
Schema: map[string]*schema.Schema{
|
||||||
"weight": &schema.Schema{
|
"weight": {
|
||||||
Type: schema.TypeInt,
|
Type: schema.TypeInt,
|
||||||
Required: true,
|
Required: true,
|
||||||
},
|
},
|
||||||
|
@ -203,12 +203,12 @@ func resourceAwsRoute53Record() *schema.Resource {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
"health_check_id": &schema.Schema{ // ID of health check
|
"health_check_id": { // ID of health check
|
||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Optional: true,
|
Optional: true,
|
||||||
},
|
},
|
||||||
|
|
||||||
"records": &schema.Schema{
|
"records": {
|
||||||
Type: schema.TypeSet,
|
Type: schema.TypeSet,
|
||||||
ConflictsWith: []string{"alias"},
|
ConflictsWith: []string{"alias"},
|
||||||
Elem: &schema.Schema{Type: schema.TypeString},
|
Elem: &schema.Schema{Type: schema.TypeString},
|
||||||
|
@ -297,11 +297,11 @@ func resourceAwsRoute53RecordUpdate(d *schema.ResourceData, meta interface{}) er
|
||||||
changeBatch := &route53.ChangeBatch{
|
changeBatch := &route53.ChangeBatch{
|
||||||
Comment: aws.String("Managed by Terraform"),
|
Comment: aws.String("Managed by Terraform"),
|
||||||
Changes: []*route53.Change{
|
Changes: []*route53.Change{
|
||||||
&route53.Change{
|
{
|
||||||
Action: aws.String("DELETE"),
|
Action: aws.String("DELETE"),
|
||||||
ResourceRecordSet: oldRec,
|
ResourceRecordSet: oldRec,
|
||||||
},
|
},
|
||||||
&route53.Change{
|
{
|
||||||
Action: aws.String("CREATE"),
|
Action: aws.String("CREATE"),
|
||||||
ResourceRecordSet: rec,
|
ResourceRecordSet: rec,
|
||||||
},
|
},
|
||||||
|
@ -368,7 +368,7 @@ func resourceAwsRoute53RecordCreate(d *schema.ResourceData, meta interface{}) er
|
||||||
changeBatch := &route53.ChangeBatch{
|
changeBatch := &route53.ChangeBatch{
|
||||||
Comment: aws.String("Managed by Terraform"),
|
Comment: aws.String("Managed by Terraform"),
|
||||||
Changes: []*route53.Change{
|
Changes: []*route53.Change{
|
||||||
&route53.Change{
|
{
|
||||||
Action: aws.String("UPSERT"),
|
Action: aws.String("UPSERT"),
|
||||||
ResourceRecordSet: rec,
|
ResourceRecordSet: rec,
|
||||||
},
|
},
|
||||||
|
@ -470,8 +470,6 @@ func resourceAwsRoute53RecordRead(d *schema.ResourceData, meta interface{}) erro
|
||||||
if len(parts) > 3 {
|
if len(parts) > 3 {
|
||||||
d.Set("set_identifier", parts[3])
|
d.Set("set_identifier", parts[3])
|
||||||
}
|
}
|
||||||
|
|
||||||
d.Set("weight", -1)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
record, err := findRecord(d, meta)
|
record, err := findRecord(d, meta)
|
||||||
|
@ -631,7 +629,7 @@ func resourceAwsRoute53RecordDelete(d *schema.ResourceData, meta interface{}) er
|
||||||
changeBatch := &route53.ChangeBatch{
|
changeBatch := &route53.ChangeBatch{
|
||||||
Comment: aws.String("Deleted by Terraform"),
|
Comment: aws.String("Deleted by Terraform"),
|
||||||
Changes: []*route53.Change{
|
Changes: []*route53.Change{
|
||||||
&route53.Change{
|
{
|
||||||
Action: aws.String("DELETE"),
|
Action: aws.String("DELETE"),
|
||||||
ResourceRecordSet: rec,
|
ResourceRecordSet: rec,
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue