Merge pull request #9830 from fatmcgav/openstack_fw_policy_shared_fix

provider/openstack: Don't default 'shared' value, instead only set if…
This commit is contained in:
Joe Topjian 2016-11-03 09:08:52 -06:00 committed by GitHub
commit a8c750d4f7
2 changed files with 9 additions and 6 deletions

View File

@ -44,7 +44,6 @@ func resourceFWPolicyV1() *schema.Resource {
"shared": &schema.Schema{ "shared": &schema.Schema{
Type: schema.TypeBool, Type: schema.TypeBool,
Optional: true, Optional: true,
Default: false,
}, },
"tenant_id": &schema.Schema{ "tenant_id": &schema.Schema{
Type: schema.TypeString, Type: schema.TypeString,
@ -79,17 +78,20 @@ func resourceFWPolicyV1Create(d *schema.ResourceData, meta interface{}) error {
} }
audited := d.Get("audited").(bool) audited := d.Get("audited").(bool)
shared := d.Get("shared").(bool)
opts := policies.CreateOpts{ opts := policies.CreateOpts{
Name: d.Get("name").(string), Name: d.Get("name").(string),
Description: d.Get("description").(string), Description: d.Get("description").(string),
Audited: &audited, Audited: &audited,
Shared: &shared,
TenantID: d.Get("tenant_id").(string), TenantID: d.Get("tenant_id").(string),
Rules: rules, Rules: rules,
} }
if r, ok := d.GetOk("shared"); ok {
shared := r.(bool)
opts.Shared = &shared
}
log.Printf("[DEBUG] Create firewall policy: %#v", opts) log.Printf("[DEBUG] Create firewall policy: %#v", opts)
policy, err := policies.Create(networkingClient, opts).Extract() policy, err := policies.Create(networkingClient, opts).Extract()

View File

@ -64,9 +64,10 @@ The following arguments are supported:
firewall policy. firewall policy.
* `shared` - (Optional) Sharing status of the firewall policy (must be "true" * `shared` - (Optional) Sharing status of the firewall policy (must be "true"
or "false" if provided - defaults to "false"). If this is "true" the policy or "false" if provided). If this is "true" the policy is visible to, and
is visible to, and can be used in, firewalls in other tenants. Changing this can be used in, firewalls in other tenants. Changing this updates the
updates the `shared` status of an existing firewall policy. `shared` status of an existing firewall policy. Only administrative users
can specify if the policy should be shared.
## Attributes Reference ## Attributes Reference