Skip to content

Commit

Permalink
Merge pull request #26 from Bowbaq/mb-update-ip-whitelist
Browse files Browse the repository at this point in the history
Allow IP whitelist comment to be updated
  • Loading branch information
akshaykarle authored Jul 27, 2018
2 parents e0f8ad7 + 31c3811 commit 61b54fa
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions mongodbatlas/ip_whitelist.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,11 @@ func resourceIPWhitelist() *schema.Resource {
ForceNew: true,
},
"cidr_block": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
ConflictsWith: []string{"ip_address"},
},
"ip_address": &schema.Schema{
Type: schema.TypeString,
Expand All @@ -54,6 +55,11 @@ func resourceIPWhitelistCreate(d *schema.ResourceData, meta interface{}) error {
cidrBlock := d.Get("cidr_block").(string)
ip := d.Get("ip_address").(string)

if cidrBlock != "" && ip != "" {
// cidrBlock & ip are mutually exclusive, use cidrBlock if both are set
ip = ""
}

params := []ma.Whitelist{
ma.Whitelist{
CidrBlock: cidrBlock,
Expand Down Expand Up @@ -96,7 +102,7 @@ func resourceIPWhitelistRead(d *schema.ResourceData, meta interface{}) error {
}

func resourceIPWhitelistUpdate(d *schema.ResourceData, meta interface{}) error {
return nil
return resourceIPWhitelistCreate(d, meta)
}

func resourceIPWhitelistDelete(d *schema.ResourceData, meta interface{}) error {
Expand Down

0 comments on commit 61b54fa

Please sign in to comment.