Skip to content

Commit 0506095

Browse files
committed
Add set check
1 parent 2255680 commit 0506095

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

mongodbatlas/resource_mongodbatlas_vpc_peering_connection.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,9 +312,13 @@ func resourceVpcPeeringConnectionImportState(d *schema.ResourceData, meta interf
312312
// https://docs.atlas.mongodb.com/reference/api/vpc-get-connection/#example-response
313313
// Atlas API does not return ProviderName, so we have to guess it from other parameters
314314
if peer.AwsAccountID != "" {
315-
d.Set("provider_name", "AWS")
315+
if err := d.Set("provider_name", "AWS"); err != nil {
316+
return nil, fmt.Errorf("Error setting provider name: %v", err)
317+
}
316318
} else if peer.GcpProjectID != "" {
317-
d.Set("provider_name", "GCP")
319+
if err := d.Set("provider_name", "GCP"); err != nil {
320+
return nil, fmt.Errorf("Error setting provider name: %v", err)
321+
}
318322
}
319323

320324
d.SetId(peer.ID)

mongodbatlas/resource_mongodbatlas_vpc_peering_connection_migrate.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,48 +7,48 @@ import (
77
func resourceVpcPeeringConnectionResourceV0() *schema.Resource {
88
return &schema.Resource{
99
Schema: map[string]*schema.Schema{
10-
"group": &schema.Schema{
10+
"group": {
1111
Type: schema.TypeString,
1212
Required: true,
1313
ForceNew: true,
1414
},
15-
"route_table_cidr_block": &schema.Schema{
15+
"route_table_cidr_block": {
1616
Type: schema.TypeString,
1717
Required: true,
1818
},
19-
"aws_account_id": &schema.Schema{
19+
"aws_account_id": {
2020
Type: schema.TypeString,
2121
Required: true,
2222
ForceNew: true,
2323
},
24-
"vpc_id": &schema.Schema{
24+
"vpc_id": {
2525
Type: schema.TypeString,
2626
Required: true,
2727
ForceNew: true,
2828
},
29-
"container_id": &schema.Schema{
29+
"container_id": {
3030
Type: schema.TypeString,
3131
Required: true,
3232
ForceNew: true,
3333
},
34-
"identifier": &schema.Schema{
34+
"identifier": {
3535
Type: schema.TypeString,
3636
Optional: true,
3737
ForceNew: true,
3838
Computed: true,
3939
},
40-
"connection_id": &schema.Schema{
40+
"connection_id": {
4141
Type: schema.TypeString,
4242
Optional: true,
4343
ForceNew: true,
4444
Computed: true,
4545
},
46-
"status_name": &schema.Schema{
46+
"status_name": {
4747
Type: schema.TypeString,
4848
Optional: true,
4949
Computed: true,
5050
},
51-
"error_state_name": &schema.Schema{
51+
"error_state_name": {
5252
Type: schema.TypeString,
5353
Optional: true,
5454
Computed: true,

0 commit comments

Comments
 (0)