func setAllowAccessAttribute( d *schema.ResourceData, database_server *brightbox.DatabaseServer, ) { d.Set("allow_access", database_server.AllowAccess) d.SetPartial("allow_access") }
func resourceAwsSubnetUpdate(d *schema.ResourceData, meta interface{}) error { ec2conn := meta.(*AWSClient).ec2conn d.Partial(true) if err := setTags(ec2conn, d); err != nil { return err } else { d.SetPartial("tags") } if d.HasChange("map_public_ip_on_launch") { modifyOpts := &ec2.ModifySubnetAttribute{ SubnetId: d.Id(), MapPublicIpOnLaunch: true, } log.Printf("[DEBUG] Subnet modify attributes: %#v", modifyOpts) _, err := ec2conn.ModifySubnetAttribute(modifyOpts) if err != nil { return err } else { d.SetPartial("map_public_ip_on_launch") } } d.Partial(false) return resourceAwsSubnetRead(d, meta) }
func resourceAwsProxyProtocolPolicyCreate(d *schema.ResourceData, meta interface{}) error { elbconn := meta.(*AWSClient).elbconn elbname := aws.String(d.Get("load_balancer").(string)) input := &elb.CreateLoadBalancerPolicyInput{ LoadBalancerName: elbname, PolicyAttributes: []*elb.PolicyAttribute{ &elb.PolicyAttribute{ AttributeName: aws.String("ProxyProtocol"), AttributeValue: aws.String("True"), }, }, PolicyName: aws.String("TFEnableProxyProtocol"), PolicyTypeName: aws.String("ProxyProtocolPolicyType"), } // Create a policy log.Printf("[DEBUG] ELB create a policy %s from policy type %s", *input.PolicyName, *input.PolicyTypeName) if _, err := elbconn.CreateLoadBalancerPolicy(input); err != nil { return fmt.Errorf("Error creating a policy %s: %s", *input.PolicyName, err) } // Assign the policy name for use later d.Partial(true) d.SetId(fmt.Sprintf("%s:%s", *elbname, *input.PolicyName)) d.SetPartial("load_balancer") log.Printf("[INFO] ELB PolicyName: %s", *input.PolicyName) return resourceAwsProxyProtocolPolicyUpdate(d, meta) }
func resourceAwsAmiCopyCreate(d *schema.ResourceData, meta interface{}) error { client := meta.(*AWSClient).ec2conn req := &ec2.CopyImageInput{ Name: aws.String(d.Get("name").(string)), Description: aws.String(d.Get("description").(string)), SourceImageId: aws.String(d.Get("source_ami_id").(string)), SourceRegion: aws.String(d.Get("source_ami_region").(string)), } res, err := client.CopyImage(req) if err != nil { return err } id := *res.ImageId d.SetId(id) d.Partial(true) // make sure we record the id even if the rest of this gets interrupted d.Set("id", id) d.Set("manage_ebs_snapshots", true) d.SetPartial("id") d.SetPartial("manage_ebs_snapshots") d.Partial(false) _, err = resourceAwsAmiWaitForAvailable(id, client) if err != nil { return err } return resourceAwsAmiUpdate(d, meta) }
func resourceAwsInstanceUpdate(d *schema.ResourceData, meta interface{}) error { ec2conn := meta.(*AWSClient).ec2conn modify := false opts := new(ec2.ModifyInstance) if v, ok := d.GetOk("source_dest_check"); ok { opts.SourceDestCheck = v.(bool) opts.SetSourceDestCheck = true modify = true } if modify { log.Printf("[INFO] Modifing instance %s: %#v", d.Id(), opts) if _, err := ec2conn.ModifyInstance(d.Id(), opts); err != nil { return err } // TODO(mitchellh): wait for the attributes we modified to // persist the change... } if err := setTags(ec2conn, d); err != nil { return err } else { d.SetPartial("tags") } return nil }
func resourceAwsInstanceUpdate(d *schema.ResourceData, meta interface{}) error { ec2conn := meta.(*AWSClient).ec2conn // SourceDestCheck can only be set on VPC instances if d.Get("subnet_id").(string) != "" { log.Printf("[INFO] Modifying instance %s", d.Id()) err := ec2conn.ModifyInstanceAttribute(&ec2.ModifyInstanceAttributeRequest{ InstanceID: aws.String(d.Id()), SourceDestCheck: &ec2.AttributeBooleanValue{ Value: aws.Boolean(d.Get("source_dest_check").(bool)), }, }) if err != nil { return err } } // TODO(mitchellh): wait for the attributes we modified to // persist the change... if err := setTags(ec2conn, d); err != nil { return err } else { d.SetPartial("tags") } return nil }
func resourceAwsSecurityGroupUpdate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).ec2conn sgRaw, _, err := SGStateRefreshFunc(conn, d.Id())() if err != nil { return err } if sgRaw == nil { d.SetId("") return nil } group := sgRaw.(*ec2.SecurityGroup) err = resourceAwsSecurityGroupUpdateRules(d, "ingress", meta, group) if err != nil { return err } if d.Get("vpc_id") != nil { err = resourceAwsSecurityGroupUpdateRules(d, "egress", meta, group) if err != nil { return err } } if err := setTags(conn, d); err != nil { return err } d.SetPartial("tags") return resourceAwsSecurityGroupRead(d, meta) }
func resourceAwsElbUpdate(d *schema.ResourceData, meta interface{}) error { elbconn := meta.(*AWSClient).elbconn d.Partial(true) // If we currently have instances, or did have instances, // we want to figure out what to add and remove from the load // balancer if d.HasChange("instances") { o, n := d.GetChange("instances") os := o.(*schema.Set) ns := n.(*schema.Set) remove := expandStringList(os.Difference(ns).List()) add := expandStringList(ns.Difference(os).List()) if len(add) > 0 { registerInstancesOpts := elb.RegisterInstancesWithLoadBalancer{ LoadBalancerName: d.Id(), Instances: add, } _, err := elbconn.RegisterInstancesWithLoadBalancer(®isterInstancesOpts) if err != nil { return fmt.Errorf("Failure registering instances: %s", err) } } if len(remove) > 0 { deRegisterInstancesOpts := elb.DeregisterInstancesFromLoadBalancer{ LoadBalancerName: d.Id(), Instances: remove, } _, err := elbconn.DeregisterInstancesFromLoadBalancer(&deRegisterInstancesOpts) if err != nil { return fmt.Errorf("Failure deregistering instances: %s", err) } } d.SetPartial("instances") } log.Println("[INFO] outside modify attributes") if d.HasChange("cross_zone_load_balancing") { log.Println("[INFO] inside modify attributes") attrs := elb.ModifyLoadBalancerAttributes{ LoadBalancerName: d.Get("name").(string), LoadBalancerAttributes: elb.LoadBalancerAttributes{ CrossZoneLoadBalancingEnabled: d.Get("cross_zone_load_balancing").(bool), }, } _, err := elbconn.ModifyLoadBalancerAttributes(&attrs) if err != nil { return fmt.Errorf("Failure configuring health check: %s", err) } d.SetPartial("cross_zone_load_balancing") } d.Partial(false) return resourceAwsElbRead(d, meta) }
func resourceAwsSubnetUpdate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).ec2conn d.Partial(true) if err := setTags(conn, d); err != nil { return err } else { d.SetPartial("tags") } if d.HasChange("map_public_ip_on_launch") { modifyOpts := &ec2.ModifySubnetAttributeInput{ SubnetId: aws.String(d.Id()), MapPublicIpOnLaunch: &ec2.AttributeBooleanValue{ Value: aws.Bool(d.Get("map_public_ip_on_launch").(bool)), }, } log.Printf("[DEBUG] Subnet modify attributes: %#v", modifyOpts) _, err := conn.ModifySubnetAttribute(modifyOpts) if err != nil { return err } else { d.SetPartial("map_public_ip_on_launch") } } d.Partial(false) return resourceAwsSubnetRead(d, meta) }
func resourceAwsRoute53ZoneUpdate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).r53conn d.Partial(true) if d.HasChange("comment") { zoneInput := route53.UpdateHostedZoneCommentInput{ Id: aws.String(d.Id()), Comment: aws.String(d.Get("comment").(string)), } _, err := conn.UpdateHostedZoneComment(&zoneInput) if err != nil { return err } else { d.SetPartial("comment") } } if err := setTagsR53(conn, d, "hostedzone"); err != nil { return err } else { d.SetPartial("tags") } d.Partial(false) return resourceAwsRoute53ZoneRead(d, meta) }
func resourceAwsDirectoryServiceDirectoryUpdate(d *schema.ResourceData, meta interface{}) error { dsconn := meta.(*AWSClient).dsconn if d.HasChange("enable_sso") { d.SetPartial("enable_sso") var err error if v, ok := d.GetOk("enable_sso"); ok && v.(bool) { log.Printf("[DEBUG] Enabling SSO for DS directory %q", d.Id()) _, err = dsconn.EnableSso(&directoryservice.EnableSsoInput{ DirectoryId: aws.String(d.Id()), }) } else { log.Printf("[DEBUG] Disabling SSO for DS directory %q", d.Id()) _, err = dsconn.DisableSso(&directoryservice.DisableSsoInput{ DirectoryId: aws.String(d.Id()), }) } if err != nil { return err } } return resourceAwsDirectoryServiceDirectoryRead(d, meta) }
func resourceAwsRouteTableUpdate(d *schema.ResourceData, meta interface{}) error { ec2conn := meta.(*AWSClient).ec2conn // Check if the route set as a whole has changed if d.HasChange("route") { o, n := d.GetChange("route") ors := o.(*schema.Set).Difference(n.(*schema.Set)) nrs := n.(*schema.Set).Difference(o.(*schema.Set)) // Now first loop through all the old routes and delete any obsolete ones for _, route := range ors.List() { m := route.(map[string]interface{}) // Delete the route as it no longer exists in the config log.Printf( "[INFO] Deleting route from %s: %s", d.Id(), m["cidr_block"].(string)) err := ec2conn.DeleteRoute(&ec2.DeleteRouteRequest{ RouteTableID: aws.String(d.Id()), DestinationCIDRBlock: aws.String(m["cidr_block"].(string)), }) if err != nil { return err } } // Make sure we save the state of the currently configured rules routes := o.(*schema.Set).Intersection(n.(*schema.Set)) d.Set("route", routes) // Then loop through al the newly configured routes and create them for _, route := range nrs.List() { m := route.(map[string]interface{}) opts := ec2.CreateRouteRequest{ RouteTableID: aws.String(d.Id()), DestinationCIDRBlock: aws.String(m["cidr_block"].(string)), GatewayID: aws.String(m["gateway_id"].(string)), InstanceID: aws.String(m["instance_id"].(string)), VPCPeeringConnectionID: aws.String(m["vpc_peering_connection_id"].(string)), } log.Printf("[INFO] Creating route for %s: %#v", d.Id(), opts) if err := ec2conn.CreateRoute(&opts); err != nil { return err } routes.Add(route) d.Set("route", routes) } } if err := setTags(ec2conn, d); err != nil { return err } else { d.SetPartial("tags") } return resourceAwsRouteTableRead(d, meta) }
func resourceAwsAmiUpdate(d *schema.ResourceData, meta interface{}) error { client := meta.(*AWSClient).ec2conn d.Partial(true) if err := setTags(client, d); err != nil { return err } else { d.SetPartial("tags") } if d.Get("description").(string) != "" { _, err := client.ModifyImageAttribute(&ec2.ModifyImageAttributeInput{ ImageId: aws.String(d.Id()), Description: &ec2.AttributeValue{ Value: aws.String(d.Get("description").(string)), }, }) if err != nil { return err } d.SetPartial("description") } d.Partial(false) return resourceAwsAmiRead(d, meta) }
func resourceAwsVPCPeeringUpdate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).ec2conn if err := setTags(conn, d); err != nil { return err } else { d.SetPartial("tags") } if _, ok := d.GetOk("auto_accept"); ok { pcRaw, _, err := resourceAwsVPCPeeringConnectionStateRefreshFunc(conn, d.Id())() if err != nil { return err } if pcRaw == nil { d.SetId("") return nil } pc := pcRaw.(*ec2.VpcPeeringConnection) if pc.Status != nil && *pc.Status.Code == "pending-acceptance" { status, err := resourceVPCPeeringConnectionAccept(conn, d.Id()) if err != nil { return err } log.Printf( "[DEBUG] VPC Peering connection accept status: %s", status) } } return resourceAwsVPCPeeringRead(d, meta) }
func resourceCloudcaVolumeUpdate(d *schema.ResourceData, meta interface{}) error { ccaClient := meta.(*cca.CcaClient) resources, _ := ccaClient.GetResources(d.Get("service_code").(string), d.Get("environment_name").(string)) ccaResources := resources.(cloudca.Resources) d.Partial(true) if d.HasChange("instance_id") { oldInstanceId, newInstanceId := d.GetChange("instance_id") volume := &cloudca.Volume{ Id: d.Id(), } if oldInstanceId != "" { err := ccaResources.Volumes.DetachFromInstance(volume) if err != nil { return err } } if newInstanceId != "" { err := ccaResources.Volumes.AttachToInstance(volume, newInstanceId.(string)) if err != nil { return err } } d.SetPartial("instance_id") } d.Partial(false) return resourceCloudcaVolumeRead(d, meta) }
func resourceVultrServerUpdate(d *schema.ResourceData, meta interface{}) error { client := meta.(*lib.Client) d.Partial(true) if d.HasChange("name") { oldName, newName := d.GetChange("name") err := client.RenameServer(d.Id(), newName.(string)) if err != nil { return fmt.Errorf("Error renaming server (%s): %s", d.Id(), err) } _, err = WaitForServerAttribute(d, newName.(string), []string{"", oldName.(string)}, "name", meta) if err != nil { return fmt.Errorf("Error waiting for rename server (%s) to finish: %s", d.Id(), err) } d.SetPartial("name") } return resourceVultrServerRead(d, meta) }
func resourceBrightboxContainerCreate( d *schema.ResourceData, meta interface{}, ) error { composite := meta.(*CompositeClient) client := composite.ApiClient log.Printf("[DEBUG] Setting Partial") d.Partial(true) log.Printf("[INFO] Creating API client") err := createApiClient(d, client) if err != nil { return err } d.SetPartial("orbit_url") container_url := createContainerUrl(createStorageUrl(d), d.Get("name").(string)) log.Printf("[INFO] Creating container at %s in Orbit", container_url) log.Printf("[DEBUG] Using Auth Token: %s", *composite.OrbitAuthToken) err = createContainer(container_url, composite.OrbitAuthToken) if err != nil { return err } log.Printf("[DEBUG] Clearing Partial") d.Partial(false) return nil }
func resourceComputeForwardingRuleUpdate(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) region := getOptionalRegion(d, config) d.Partial(true) if d.HasChange("target") { target_name := d.Get("target").(string) target_ref := &compute.TargetReference{Target: target_name} op, err := config.clientCompute.ForwardingRules.SetTarget( config.Project, region, d.Id(), target_ref).Do() if err != nil { return fmt.Errorf("Error updating target: %s", err) } err = computeOperationWaitRegion(config, op, region, "Updating Forwarding Rule") if err != nil { return err } d.SetPartial("target") } d.Partial(false) return resourceComputeForwardingRuleRead(d, meta) }
func resourceAwsDbSubnetGroupUpdate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).rdsconn if d.HasChange("subnet_ids") || d.HasChange("description") { _, n := d.GetChange("subnet_ids") if n == nil { n = new(schema.Set) } ns := n.(*schema.Set) var sIds []*string for _, s := range ns.List() { sIds = append(sIds, aws.String(s.(string))) } _, err := conn.ModifyDBSubnetGroup(&rds.ModifyDBSubnetGroupInput{ DBSubnetGroupName: aws.String(d.Id()), DBSubnetGroupDescription: aws.String(d.Get("description").(string)), SubnetIds: sIds, }) if err != nil { return err } } if arn, err := buildRDSsubgrpARN(d.Id(), meta.(*AWSClient).accountid, meta.(*AWSClient).region); err == nil { if err := setTagsRDS(conn, d, arn); err != nil { return err } else { d.SetPartial("tags") } } return resourceAwsDbSubnetGroupRead(d, meta) }
func UpdateRepository(d *schema.ResourceData, meta interface{}) error { client := meta.(*Client) d.Partial(true) if d.HasChange("name") { // Renaming has its own special operation. err := RenameRepository(d, meta) if err != nil { return err } d.SetPartial("name") } req := &RepositoryWrap{ Repository: Repository{ Title: d.Get("title").(string), ColorLabel: d.Get("color_label").(string), DefaultGitBranch: d.Get("default_git_branch").(string), }, } err := client.Put([]string{"repositories", d.Id()}, req, nil) if err != nil { return err } d.Partial(false) return ReadRepository(d, meta) }
func resourceComputeTargetHttpProxyUpdate(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) d.Partial(true) if d.HasChange("url_map") { url_map := d.Get("url_map").(string) url_map_ref := &compute.UrlMapReference{UrlMap: url_map} op, err := config.clientCompute.TargetHttpProxies.SetUrlMap( config.Project, d.Id(), url_map_ref).Do() if err != nil { return fmt.Errorf("Error updating target: %s", err) } err = computeOperationWaitGlobal(config, op, "Updating Target Http Proxy") if err != nil { return err } d.SetPartial("url_map") } d.Partial(false) return resourceComputeTargetHttpProxyRead(d, meta) }
func instanceProfileSetRoles(d *schema.ResourceData, iamconn *iam.IAM) error { oldInterface, newInterface := d.GetChange("roles") oldRoles := oldInterface.(*schema.Set) newRoles := newInterface.(*schema.Set) currentRoles := schema.CopySet(oldRoles) d.Partial(true) for _, role := range oldRoles.Difference(newRoles).List() { err := instanceProfileRemoveRole(iamconn, d.Id(), role.(string)) if err != nil { return fmt.Errorf("Error removing role %s from IAM instance profile %s: %s", role, d.Id(), err) } currentRoles.Remove(role) d.Set("roles", currentRoles) d.SetPartial("roles") } for _, role := range newRoles.Difference(oldRoles).List() { err := instanceProfileAddRole(iamconn, d.Id(), role.(string)) if err != nil { return fmt.Errorf("Error adding role %s to IAM instance profile %s: %s", role, d.Id(), err) } currentRoles.Add(role) d.Set("roles", currentRoles) d.SetPartial("roles") } d.Partial(false) return nil }
func resourceAwsInstanceUpdate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).ec2conn d.Partial(true) if err := setTags(conn, d); err != nil { return err } else { d.SetPartial("tags") } // SourceDestCheck can only be set on VPC instances if d.Get("subnet_id").(string) != "" { log.Printf("[INFO] Modifying instance %s", d.Id()) _, err := conn.ModifyInstanceAttribute(&ec2.ModifyInstanceAttributeInput{ InstanceID: aws.String(d.Id()), SourceDestCheck: &ec2.AttributeBooleanValue{ Value: aws.Boolean(d.Get("source_dest_check").(bool)), }, }) if err != nil { return err } } if d.HasChange("vpc_security_group_ids") { var groups []*string if v := d.Get("vpc_security_group_ids").(*schema.Set); v.Len() > 0 { for _, v := range v.List() { groups = append(groups, aws.String(v.(string))) } } _, err := conn.ModifyInstanceAttribute(&ec2.ModifyInstanceAttributeInput{ InstanceID: aws.String(d.Id()), Groups: groups, }) if err != nil { return err } } if d.HasChange("disable_api_termination") { _, err := conn.ModifyInstanceAttribute(&ec2.ModifyInstanceAttributeInput{ InstanceID: aws.String(d.Id()), DisableAPITermination: &ec2.AttributeBooleanValue{ Value: aws.Boolean(d.Get("disable_api_termination").(bool)), }, }) if err != nil { return err } } // TODO(mitchellh): wait for the attributes we modified to // persist the change... d.Partial(false) return resourceAwsInstanceRead(d, meta) }
func setApiClientAttributes( d *schema.ResourceData, api_client *brightbox.ApiClient, ) { d.Set("name", api_client.Name) d.Set("description", api_client.Description) d.SetPartial("name") d.SetPartial("description") }
func resourceCloudcaInstanceUpdate(d *schema.ResourceData, meta interface{}) error { ccaClient := meta.(*cca.CcaClient) resources, _ := ccaClient.GetResources(d.Get("service_code").(string), d.Get("environment_name").(string)) ccaResources := resources.(cloudca.Resources) d.Partial(true) if d.HasChange("compute_offering") || d.HasChange("cpu_count") || d.HasChange("memory_in_mb") { newComputeOffering := d.Get("compute_offering").(string) log.Printf("[DEBUG] Compute offering has changed for %s, changing compute offering...", newComputeOffering) newComputeOfferingId, ferr := retrieveComputeOfferingID(&ccaResources, newComputeOffering) if ferr != nil { return ferr } instanceToUpdate := cloudca.Instance{Id: d.Id(), ComputeOfferingId: newComputeOfferingId, } hasCustomFields := false if cpuCount, ok := d.GetOk("cpu_count"); ok { instanceToUpdate.CpuCount = cpuCount.(int) hasCustomFields = true } if memoryInMB, ok := d.GetOk("memory_in_mb"); ok { instanceToUpdate.MemoryInMB = memoryInMB.(int) hasCustomFields = true } computeOffering, cerr := ccaResources.ComputeOfferings.Get(newComputeOfferingId) if cerr != nil { return cerr } else if !computeOffering.Custom && hasCustomFields { return fmt.Errorf("Cannot have a CPU count or memory in MB because \"%s\" isn't a custom compute offering", computeOffering.Name) } _, err := ccaResources.Instances.ChangeComputeOffering(instanceToUpdate) if err != nil { return err } d.SetPartial("compute_offering") } if d.HasChange("ssh_key_name") { sshKeyName := d.Get("ssh_key_name").(string) log.Printf("[DEBUG] SSH key name has changed for %s, associating new SSH key...", sshKeyName) _, err := ccaResources.Instances.AssociateSSHKey(d.Id(), sshKeyName) if err != nil { return err } d.SetPartial("ssh_key_name") } d.Partial(false) return nil }
func resourceAwsDbOptionGroupUpdate(d *schema.ResourceData, meta interface{}) error { rdsconn := meta.(*AWSClient).rdsconn if d.HasChange("option") { o, n := d.GetChange("option") if o == nil { o = new(schema.Set) } if n == nil { n = new(schema.Set) } os := o.(*schema.Set) ns := n.(*schema.Set) addOptions, addErr := expandOptionConfiguration(ns.Difference(os).List()) if addErr != nil { return addErr } removeOptions, removeErr := flattenOptionConfigurationNames(os.Difference(ns).List()) if removeErr != nil { return removeErr } modifyOpts := &rds.ModifyOptionGroupInput{ OptionGroupName: aws.String(d.Id()), ApplyImmediately: aws.Bool(true), } if len(addOptions) > 0 { modifyOpts.OptionsToInclude = addOptions } if len(removeOptions) > 0 { modifyOpts.OptionsToRemove = removeOptions } log.Printf("[DEBUG] Modify DB Option Group: %s", modifyOpts) _, err := rdsconn.ModifyOptionGroup(modifyOpts) if err != nil { return fmt.Errorf("Error modifying DB Option Group: %s", err) } d.SetPartial("option") } if arn, err := buildRDSOptionGroupARN(d.Id(), meta.(*AWSClient).accountid, meta.(*AWSClient).region); err == nil { if err := setTagsRDS(rdsconn, d, arn); err != nil { return err } else { d.SetPartial("tags") } } return resourceAwsDbOptionGroupRead(d, meta) }
func resourceAwsProxyProtocolPolicyUpdate(d *schema.ResourceData, meta interface{}) error { elbconn := meta.(*AWSClient).elbconn elbname := aws.String(d.Get("load_balancer").(string)) // Retrieve the current ELB policies for updating the state req := &elb.DescribeLoadBalancersInput{ LoadBalancerNames: []*string{elbname}, } resp, err := elbconn.DescribeLoadBalancers(req) if err != nil { if isLoadBalancerNotFound(err) { // The ELB is gone now, so just remove it from the state d.SetId("") return nil } return fmt.Errorf("Error retrieving ELB attributes: %s", err) } backends := flattenBackendPolicies(resp.LoadBalancerDescriptions[0].BackendServerDescriptions) _, policyName := resourceAwsProxyProtocolPolicyParseId(d.Id()) d.Partial(true) if d.HasChange("instance_ports") { o, n := d.GetChange("instance_ports") os := o.(*schema.Set) ns := n.(*schema.Set) remove := os.Difference(ns).List() add := ns.Difference(os).List() inputs := []*elb.SetLoadBalancerPoliciesForBackendServerInput{} i, err := resourceAwsProxyProtocolPolicyRemove(policyName, remove, backends) if err != nil { return err } inputs = append(inputs, i...) i, err = resourceAwsProxyProtocolPolicyAdd(policyName, add, backends) if err != nil { return err } inputs = append(inputs, i...) for _, input := range inputs { input.LoadBalancerName = elbname if _, err := elbconn.SetLoadBalancerPoliciesForBackendServer(input); err != nil { return fmt.Errorf("Error setting policy for backend: %s", err) } } d.SetPartial("instance_ports") } return resourceAwsProxyProtocolPolicyRead(d, meta) }
func resourceAwsRoute53ZoneUpdate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).r53conn if err := setTagsR53(conn, d, "hostedzone"); err != nil { return err } else { d.SetPartial("tags") } return resourceAwsRoute53ZoneRead(d, meta) }
func resourceAwsVpcPeeringUpdate(d *schema.ResourceData, meta interface{}) error { ec2conn := meta.(*AWSClient).ec2conn if err := setTags(ec2conn, d); err != nil { return err } else { d.SetPartial("tags") } return resourceAwsRouteTableRead(d, meta) }
func resourceAwsCustomerGatewayUpdate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).ec2conn // Update tags if required. if err := setTags(conn, d); err != nil { return err } d.SetPartial("tags") return resourceAwsCustomerGatewayRead(d, meta) }