Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

provider/openstack allow floating ip to target a specific tenant #6454

Merged
merged 1 commit into from
May 25, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ func resourceNetworkingFloatingIPV2() *schema.Resource {
Optional: true,
Computed: true,
},
"tenant_id": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
},
},
}
}
Expand All @@ -64,6 +70,7 @@ func resourceNetworkFloatingIPV2Create(d *schema.ResourceData, meta interface{})
createOpts := floatingips.CreateOpts{
FloatingNetworkID: poolID,
PortID: d.Get("port_id").(string),
TenantID: d.Get("tenant_id").(string),
}
log.Printf("[DEBUG] Create Options: %#v", createOpts)
floatingIP, err := floatingips.Create(networkingClient, createOpts).Extract()
Expand Down Expand Up @@ -107,6 +114,7 @@ func resourceNetworkFloatingIPV2Read(d *schema.ResourceData, meta interface{}) e
return fmt.Errorf("Error retrieving floating IP pool name: %s", err)
}
d.Set("pool", poolName)
d.Set("tenant_id", floatingIP.TenantID)

return nil
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,13 @@ The following arguments are supported:
* `pool` - (Required) The name of the pool from which to obtain the floating
IP. Changing this creates a new floating IP.

* `port_id` - ID of an existing port with at least one IP address to associate with
this floating IP.
* `port_id` - (Optional) ID of an existing port with at least one IP address to
associate with this floating IP.

* `tenant_id` - (Optional) The target tenant ID in which to allocate the floating
IP, if you specify this together with a port_id, make sure the target port
belongs to the same tenant. Changing this creates a new floating IP (which
may or may not have a different address)

## Attributes Reference

Expand All @@ -46,3 +51,4 @@ The following attributes are exported:
* `pool` - See Argument Reference above.
* `address` - The actual floating IP address itself.
* `port_id` - ID of associated port.
* `tenant_id` - the ID of the tenant in which to create the floating IP.