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

Fix and enable tfproviderlint R005 check: Combine multiple d.HasChange() calls with d.HasChanges() call #12811

Merged
merged 3 commits into from
Jun 16, 2020
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
1 change: 1 addition & 0 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ awsproviderlint:
-R002 \
-R003 \
-R004 \
-R005 \
-R006 \
-R007 \
-R008 \
Expand Down
2 changes: 1 addition & 1 deletion aws/autoscaling_tags.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func setAutoscalingTags(conn *autoscaling.AutoScaling, d *schema.ResourceData) e
resourceID := d.Get("name").(string)
var createTags, removeTags []*autoscaling.Tag

if d.HasChange("tag") || d.HasChange("tags") {
if d.HasChanges("tag", "tags") {
oraw, nraw := d.GetChange("tag")
o := setToMapByKey(oraw.(*schema.Set))
n := setToMapByKey(nraw.(*schema.Set))
Expand Down
2 changes: 1 addition & 1 deletion aws/resource_aws_acm_certificate.go
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ func resourceAwsAcmCertificateValidationMethod(certificate *acm.CertificateDetai
func resourceAwsAcmCertificateUpdate(d *schema.ResourceData, meta interface{}) error {
acmconn := meta.(*AWSClient).acmconn

if d.HasChange("private_key") || d.HasChange("certificate_body") || d.HasChange("certificate_chain") {
if d.HasChanges("private_key", "certificate_body", "certificate_chain") {
_, err := resourceAwsAcmCertificateImport(acmconn, d, true)
if err != nil {
return fmt.Errorf("Error updating certificate: %s", err)
Expand Down
2 changes: 1 addition & 1 deletion aws/resource_aws_cloudtrail.go
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ func resourceAwsCloudTrailUpdate(d *schema.ResourceData, meta interface{}) error
if d.HasChange("s3_key_prefix") {
input.S3KeyPrefix = aws.String(d.Get("s3_key_prefix").(string))
}
if d.HasChange("cloud_watch_logs_role_arn") || d.HasChange("cloud_watch_logs_group_arn") {
if d.HasChanges("cloud_watch_logs_role_arn", "cloud_watch_logs_group_arn") {
// Both of these need to be provided together
// in the update call otherwise API complains
input.CloudWatchLogsRoleArn = aws.String(d.Get("cloud_watch_logs_role_arn").(string))
Expand Down
2 changes: 1 addition & 1 deletion aws/resource_aws_datasync_task.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ func resourceAwsDataSyncTaskRead(d *schema.ResourceData, meta interface{}) error
func resourceAwsDataSyncTaskUpdate(d *schema.ResourceData, meta interface{}) error {
conn := meta.(*AWSClient).datasyncconn

if d.HasChange("options") || d.HasChange("name") {
if d.HasChanges("options", "name") {
input := &datasync.UpdateTaskInput{
Options: expandDataSyncOptions(d.Get("options").([]interface{})),
Name: aws.String(d.Get("name").(string)),
Expand Down
6 changes: 3 additions & 3 deletions aws/resource_aws_db_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -1460,7 +1460,7 @@ func resourceAwsDbInstanceUpdate(d *schema.ResourceData, meta interface{}) error
}

requestUpdate := false
if d.HasChange("allocated_storage") || d.HasChange("iops") {
if d.HasChanges("allocated_storage", "iops") {
req.Iops = aws.Int64(int64(d.Get("iops").(int)))
req.AllocatedStorage = aws.Int64(int64(d.Get("allocated_storage").(int)))
requestUpdate = true
Expand Down Expand Up @@ -1593,13 +1593,13 @@ func resourceAwsDbInstanceUpdate(d *schema.ResourceData, meta interface{}) error
requestUpdate = true
}

if d.HasChange("domain") || d.HasChange("domain_iam_role_name") {
if d.HasChanges("domain", "domain_iam_role_name") {
req.Domain = aws.String(d.Get("domain").(string))
req.DomainIAMRoleName = aws.String(d.Get("domain_iam_role_name").(string))
requestUpdate = true
}

if d.HasChange("performance_insights_enabled") || d.HasChange("performance_insights_kms_key_id") || d.HasChange("performance_insights_retention_period") {
if d.HasChanges("performance_insights_enabled", "performance_insights_kms_key_id", "performance_insights_retention_period") {
req.EnablePerformanceInsights = aws.Bool(d.Get("performance_insights_enabled").(bool))

if v, ok := d.GetOk("performance_insights_kms_key_id"); ok {
Expand Down
2 changes: 1 addition & 1 deletion aws/resource_aws_db_subnet_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ func resourceAwsDbSubnetGroupRead(d *schema.ResourceData, meta interface{}) erro

func resourceAwsDbSubnetGroupUpdate(d *schema.ResourceData, meta interface{}) error {
conn := meta.(*AWSClient).rdsconn
if d.HasChange("subnet_ids") || d.HasChange("description") {
if d.HasChanges("subnet_ids", "description") {
_, n := d.GetChange("subnet_ids")
if n == nil {
n = new(schema.Set)
Expand Down
26 changes: 8 additions & 18 deletions aws/resource_aws_dms_endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -588,17 +588,10 @@ func resourceAwsDmsEndpointUpdate(d *schema.ResourceData, meta interface{}) erro
hasChanges = true
}
case "mongodb":
if d.HasChange("username") ||
d.HasChange("password") ||
d.HasChange("server_name") ||
d.HasChange("port") ||
d.HasChange("database_name") ||
d.HasChange("mongodb_settings.0.auth_type") ||
d.HasChange("mongodb_settings.0.auth_mechanism") ||
d.HasChange("mongodb_settings.0.nesting_level") ||
d.HasChange("mongodb_settings.0.extract_doc_id") ||
d.HasChange("mongodb_settings.0.docs_to_investigate") ||
d.HasChange("mongodb_settings.0.auth_source") {
if d.HasChanges(
"username", "password", "server_name", "port", "database_name", "mongodb_settings.0.auth_type",
"mongodb_settings.0.auth_mechanism", "mongodb_settings.0.nesting_level", "mongodb_settings.0.extract_doc_id",
"mongodb_settings.0.docs_to_investigate", "mongodb_settings.0.auth_source") {
request.MongoDbSettings = &dms.MongoDbSettings{
Username: aws.String(d.Get("username").(string)),
Password: aws.String(d.Get("password").(string)),
Expand Down Expand Up @@ -626,13 +619,10 @@ func resourceAwsDmsEndpointUpdate(d *schema.ResourceData, meta interface{}) erro
hasChanges = true
}
case "s3":
if d.HasChange("s3_settings.0.service_access_role_arn") ||
d.HasChange("s3_settings.0.external_table_definition") ||
d.HasChange("s3_settings.0.csv_row_delimiter") ||
d.HasChange("s3_settings.0.csv_delimiter") ||
d.HasChange("s3_settings.0.bucket_folder") ||
d.HasChange("s3_settings.0.bucket_name") ||
d.HasChange("s3_settings.0.compression_type") {
if d.HasChanges(
"s3_settings.0.service_access_role_arn", "s3_settings.0.external_table_definition",
"s3_settings.0.csv_row_delimiter", "s3_settings.0.csv_delimiter", "s3_settings.0.bucket_folder",
"s3_settings.0.bucket_name", "s3_settings.0.compression_type") {
request.S3Settings = &dms.S3Settings{
ServiceAccessRoleArn: aws.String(d.Get("s3_settings.0.service_access_role_arn").(string)),
ExternalTableDefinition: aws.String(d.Get("s3_settings.0.external_table_definition").(string)),
Expand Down
2 changes: 1 addition & 1 deletion aws/resource_aws_docdb_subnet_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ func resourceAwsDocDBSubnetGroupRead(d *schema.ResourceData, meta interface{}) e
func resourceAwsDocDBSubnetGroupUpdate(d *schema.ResourceData, meta interface{}) error {
conn := meta.(*AWSClient).docdbconn

if d.HasChange("subnet_ids") || d.HasChange("description") {
if d.HasChanges("subnet_ids", "description") {
_, n := d.GetChange("subnet_ids")
if n == nil {
n = new(schema.Set)
Expand Down
4 changes: 2 additions & 2 deletions aws/resource_aws_dynamodb_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ func resourceAwsDynamoDbTableUpdate(d *schema.ResourceData, meta interface{}) er
TableName: aws.String(d.Id()),
}

if d.HasChange("billing_mode") || d.HasChange("read_capacity") || d.HasChange("write_capacity") {
if d.HasChanges("billing_mode", "read_capacity", "write_capacity") {
hasTableUpdate = true

capacityMap := map[string]interface{}{
Expand All @@ -508,7 +508,7 @@ func resourceAwsDynamoDbTableUpdate(d *schema.ResourceData, meta interface{}) er
input.ProvisionedThroughput = expandDynamoDbProvisionedThroughput(capacityMap, billingMode)
}

if d.HasChange("stream_enabled") || d.HasChange("stream_view_type") {
if d.HasChanges("stream_enabled", "stream_view_type") {
hasTableUpdate = true

input.StreamSpecification = &dynamodb.StreamSpecification{
Expand Down
4 changes: 2 additions & 2 deletions aws/resource_aws_ec2_transit_gateway_vpc_attachment.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ func resourceAwsEc2TransitGatewayVpcAttachmentRead(d *schema.ResourceData, meta
func resourceAwsEc2TransitGatewayVpcAttachmentUpdate(d *schema.ResourceData, meta interface{}) error {
conn := meta.(*AWSClient).ec2conn

if d.HasChange("dns_support") || d.HasChange("ipv6_support") || d.HasChange("subnet_ids") {
if d.HasChanges("dns_support", "ipv6_support", "subnet_ids") {
input := &ec2.ModifyTransitGatewayVpcAttachmentInput{
Options: &ec2.ModifyTransitGatewayVpcAttachmentRequestOptions{
DnsSupport: aws.String(d.Get("dns_support").(string)),
Expand Down Expand Up @@ -241,7 +241,7 @@ func resourceAwsEc2TransitGatewayVpcAttachmentUpdate(d *schema.ResourceData, met
}
}

if d.HasChange("transit_gateway_default_route_table_association") || d.HasChange("transit_gateway_default_route_table_propagation") {
if d.HasChanges("transit_gateway_default_route_table_association", "transit_gateway_default_route_table_propagation") {
transitGatewayID := d.Get("transit_gateway_id").(string)

transitGateway, err := ec2DescribeTransitGateway(conn, transitGatewayID)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ func resourceAwsEc2TransitGatewayVpcAttachmentAccepterRead(d *schema.ResourceDat
func resourceAwsEc2TransitGatewayVpcAttachmentAccepterUpdate(d *schema.ResourceData, meta interface{}) error {
conn := meta.(*AWSClient).ec2conn

if d.HasChange("transit_gateway_default_route_table_association") || d.HasChange("transit_gateway_default_route_table_propagation") {
if d.HasChanges("transit_gateway_default_route_table_association", "transit_gateway_default_route_table_propagation") {
transitGatewayID := d.Get("transit_gateway_id").(string)

transitGateway, err := ec2DescribeTransitGateway(conn, transitGatewayID)
Expand Down
2 changes: 1 addition & 1 deletion aws/resource_aws_ecs_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ func resourceAwsEcsClusterUpdate(d *schema.ResourceData, meta interface{}) error
}
}

if d.HasChange("capacity_providers") || d.HasChange("default_capacity_provider_strategy") {
if d.HasChanges("capacity_providers", "default_capacity_provider_strategy") {
input := ecs.PutClusterCapacityProvidersInput{
Cluster: aws.String(d.Id()),
CapacityProviders: expandStringSet(d.Get("capacity_providers").(*schema.Set)),
Expand Down
2 changes: 1 addition & 1 deletion aws/resource_aws_ecs_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -932,7 +932,7 @@ func resourceAwsEcsServiceUpdate(d *schema.ResourceData, meta interface{}) error
input.DesiredCount = aws.Int64(int64(d.Get("desired_count").(int)))
}

if d.HasChange("deployment_maximum_percent") || d.HasChange("deployment_minimum_healthy_percent") {
if d.HasChanges("deployment_maximum_percent", "deployment_minimum_healthy_percent") {
updateService = true
input.DeploymentConfiguration = &ecs.DeploymentConfiguration{
MaximumPercent: aws.Int64(int64(d.Get("deployment_maximum_percent").(int))),
Expand Down
2 changes: 1 addition & 1 deletion aws/resource_aws_efs_file_system.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ func resourceAwsEfsFileSystemCreate(d *schema.ResourceData, meta interface{}) er
func resourceAwsEfsFileSystemUpdate(d *schema.ResourceData, meta interface{}) error {
conn := meta.(*AWSClient).efsconn

if d.HasChange("provisioned_throughput_in_mibps") || d.HasChange("throughput_mode") {
if d.HasChanges("provisioned_throughput_in_mibps", "throughput_mode") {
throughputMode := d.Get("throughput_mode").(string)

input := &efs.UpdateFileSystemInput{
Expand Down
4 changes: 2 additions & 2 deletions aws/resource_aws_eip.go
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ func resourceAwsEipUpdate(d *schema.ResourceData, meta interface{}) error {
if !d.IsNewResource() {
if d.HasChange("instance") && d.Get("instance").(string) != "" {
disassociate = true
} else if (d.HasChange("network_interface") || d.HasChange("associate_with_private_ip")) && d.Get("association_id").(string) != "" {
} else if (d.HasChanges("network_interface", "associate_with_private_ip")) && d.Get("association_id").(string) != "" {
disassociate = true
}
}
Expand All @@ -325,7 +325,7 @@ func resourceAwsEipUpdate(d *schema.ResourceData, meta interface{}) error {

if d.HasChange("instance") && ok_instance {
associate = true
} else if (d.HasChange("network_interface") || d.HasChange("associate_with_private_ip")) && ok_interface {
} else if (d.HasChanges("network_interface", "associate_with_private_ip")) && ok_interface {
associate = true
}
if associate {
Expand Down
2 changes: 1 addition & 1 deletion aws/resource_aws_eks_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ func resourceAwsEksClusterUpdate(d *schema.ResourceData, meta interface{}) error
}
}

if d.HasChange("vpc_config.0.endpoint_private_access") || d.HasChange("vpc_config.0.endpoint_public_access") || d.HasChange("vpc_config.0.public_access_cidrs") {
if d.HasChanges("vpc_config.0.endpoint_private_access", "vpc_config.0.endpoint_public_access", "vpc_config.0.public_access_cidrs") {
input := &eks.UpdateClusterConfigInput{
Name: aws.String(d.Id()),
ResourcesVpcConfig: expandEksVpcConfigUpdateRequest(d.Get("vpc_config").([]interface{})),
Expand Down
4 changes: 2 additions & 2 deletions aws/resource_aws_eks_node_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ func resourceAwsEksNodeGroupUpdate(d *schema.ResourceData, meta interface{}) err
return err
}

if d.HasChange("labels") || d.HasChange("scaling_config") {
if d.HasChanges("labels", "scaling_config") {
oldLabelsRaw, newLabelsRaw := d.GetChange("labels")

input := &eks.UpdateNodegroupConfigInput{
Expand Down Expand Up @@ -374,7 +374,7 @@ func resourceAwsEksNodeGroupUpdate(d *schema.ResourceData, meta interface{}) err
}
}

if d.HasChange("release_version") || d.HasChange("version") {
if d.HasChanges("release_version", "version") {
input := &eks.UpdateNodegroupVersionInput{
ClientRequestToken: aws.String(resource.UniqueId()),
ClusterName: aws.String(clusterName),
Expand Down
2 changes: 1 addition & 1 deletion aws/resource_aws_elasticache_subnet_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ func resourceAwsElasticacheSubnetGroupRead(d *schema.ResourceData, meta interfac

func resourceAwsElasticacheSubnetGroupUpdate(d *schema.ResourceData, meta interface{}) error {
conn := meta.(*AWSClient).elasticacheconn
if d.HasChange("subnet_ids") || d.HasChange("description") {
if d.HasChanges("subnet_ids", "description") {
var subnets []*string
if v := d.Get("subnet_ids"); v != nil {
for _, v := range v.(*schema.Set).List() {
Expand Down
2 changes: 1 addition & 1 deletion aws/resource_aws_elasticsearch_domain.go
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,7 @@ func resourceAwsElasticSearchDomainUpdate(d *schema.ResourceData, meta interface
input.DomainEndpointOptions = expandESDomainEndpointOptions(d.Get("domain_endpoint_options").([]interface{}))
}

if d.HasChange("ebs_options") || d.HasChange("cluster_config") {
if d.HasChanges("ebs_options", "cluster_config") {
options := d.Get("ebs_options").([]interface{})

if len(options) == 1 {
Expand Down
4 changes: 2 additions & 2 deletions aws/resource_aws_elb.go
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ func resourceAwsElbUpdate(d *schema.ResourceData, meta interface{}) error {
}
}

if d.HasChange("cross_zone_load_balancing") || d.HasChange("idle_timeout") || d.HasChange("access_logs") {
if d.HasChanges("cross_zone_load_balancing", "idle_timeout", "access_logs") {
attrs := elb.ModifyLoadBalancerAttributesInput{
LoadBalancerName: aws.String(d.Get("name").(string)),
LoadBalancerAttributes: &elb.LoadBalancerAttributes{
Expand Down Expand Up @@ -609,7 +609,7 @@ func resourceAwsElbUpdate(d *schema.ResourceData, meta interface{}) error {
// they have some weird undocumented rules. You can't set the timeout
// without having connection draining to true, so we set that to true,
// set the timeout, then reset it to false if requested.
if d.HasChange("connection_draining") || d.HasChange("connection_draining_timeout") {
if d.HasChanges("connection_draining", "connection_draining_timeout") {
// We do timeout changes first since they require us to set draining
// to true for a hot second.
if d.HasChange("connection_draining_timeout") {
Expand Down
2 changes: 1 addition & 1 deletion aws/resource_aws_emr_instance_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ func resourceAwsEMRInstanceGroupUpdate(d *schema.ResourceData, meta interface{})
conn := meta.(*AWSClient).emrconn

log.Printf("[DEBUG] Modify EMR task group")
if d.HasChange("instance_count") || d.HasChange("configurations_json") {
if d.HasChanges("instance_count", "configurations_json") {
instanceGroupModifyConfig := emr.InstanceGroupModifyConfig{
InstanceGroupId: aws.String(d.Id()),
}
Expand Down
3 changes: 1 addition & 2 deletions aws/resource_aws_gamelift_fleet.go
Original file line number Diff line number Diff line change
Expand Up @@ -353,8 +353,7 @@ func resourceAwsGameliftFleetUpdate(d *schema.ResourceData, meta interface{}) er

log.Printf("[INFO] Updating Gamelift Fleet: %s", d.Id())

if d.HasChange("description") || d.HasChange("metric_groups") || d.HasChange("name") ||
d.HasChange("new_game_session_protection_policy") || d.HasChange("resource_creation_limit_policy") {
if d.HasChanges("description", "metric_groups", "name", "new_game_session_protection_policy", "resource_creation_limit_policy") {
_, err := conn.UpdateFleetAttributes(&gamelift.UpdateFleetAttributesInput{
Description: aws.String(d.Get("description").(string)),
FleetId: aws.String(d.Id()),
Expand Down
2 changes: 1 addition & 1 deletion aws/resource_aws_globalaccelerator_accelerator.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ func resourceAwsGlobalAcceleratorAcceleratorRetrieve(conn *globalaccelerator.Glo
func resourceAwsGlobalAcceleratorAcceleratorUpdate(d *schema.ResourceData, meta interface{}) error {
conn := meta.(*AWSClient).globalacceleratorconn

if d.HasChange("name") || d.HasChange("ip_address_type") || d.HasChange("enabled") {
if d.HasChanges("name", "ip_address_type", "enabled") {
opts := &globalaccelerator.UpdateAcceleratorInput{
AcceleratorArn: aws.String(d.Id()),
Name: aws.String(d.Get("name").(string)),
Expand Down
2 changes: 1 addition & 1 deletion aws/resource_aws_glue_catalog_database.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func resourceAwsGlueCatalogDatabaseUpdate(d *schema.ResourceData, meta interface

dbUpdateInput.DatabaseInput = dbInput

if d.HasChange("description") || d.HasChange("location_uri") || d.HasChange("parameters") {
if d.HasChanges("description", "location_uri", "parameters") {
if _, err := glueconn.UpdateDatabase(dbUpdateInput); err != nil {
return err
}
Expand Down
15 changes: 3 additions & 12 deletions aws/resource_aws_glue_crawler.go
Original file line number Diff line number Diff line change
Expand Up @@ -457,18 +457,9 @@ func resourceAwsGlueCrawlerUpdate(d *schema.ResourceData, meta interface{}) erro
glueConn := meta.(*AWSClient).glueconn
name := d.Get("name").(string)

if d.HasChange("catalog_target") ||
d.HasChange("classifiers") ||
d.HasChange("configuration") ||
d.HasChange("description") ||
d.HasChange("dynamodb_target") ||
d.HasChange("jdbc_target") ||
d.HasChange("role") ||
d.HasChange("s3_target") ||
d.HasChange("schedule") ||
d.HasChange("schema_change_policy") ||
d.HasChange("security_configuration") ||
d.HasChange("table_prefix") {
if d.HasChanges(
"catalog_target", "classifiers", "configuration", "description", "dynamodb_target", "jdbc_target", "role",
"s3_target", "schedule", "schema_change_policy", "security_configuration", "table_prefix") {
updateCrawlerInput, err := updateCrawlerInput(name, d)
if err != nil {
return err
Expand Down
18 changes: 3 additions & 15 deletions aws/resource_aws_glue_job.go
Original file line number Diff line number Diff line change
Expand Up @@ -323,21 +323,9 @@ func resourceAwsGlueJobRead(d *schema.ResourceData, meta interface{}) error {
func resourceAwsGlueJobUpdate(d *schema.ResourceData, meta interface{}) error {
conn := meta.(*AWSClient).glueconn

if d.HasChange("allocated_capacity") ||
d.HasChange("command") ||
d.HasChange("connections") ||
d.HasChange("default_arguments") ||
d.HasChange("description") ||
d.HasChange("execution_property") ||
d.HasChange("glue_version") ||
d.HasChange("max_capacity") ||
d.HasChange("max_retries") ||
d.HasChange("notification_property") ||
d.HasChange("number_of_workers") ||
d.HasChange("role_arn") ||
d.HasChange("security_configuration") ||
d.HasChange("timeout") ||
d.HasChange("worker_type") {
if d.HasChanges("allocated_capacity", "command", "connections", "default_arguments", "description",
"execution_property", "glue_version", "max_capacity", "max_retries", "notification_property", "number_of_workers",
"role_arn", "security_configuration", "timeout", "worker_type") {
jobUpdate := &glue.JobUpdate{
Command: expandGlueJobCommand(d.Get("command").([]interface{})),
Role: aws.String(d.Get("role_arn").(string)),
Expand Down
5 changes: 1 addition & 4 deletions aws/resource_aws_glue_trigger.go
Original file line number Diff line number Diff line change
Expand Up @@ -303,10 +303,7 @@ func resourceAwsGlueTriggerRead(d *schema.ResourceData, meta interface{}) error
func resourceAwsGlueTriggerUpdate(d *schema.ResourceData, meta interface{}) error {
conn := meta.(*AWSClient).glueconn

if d.HasChange("actions") ||
d.HasChange("description") ||
d.HasChange("predicate") ||
d.HasChange("schedule") {
if d.HasChanges("actions", "description", "predicate", "schedule") {
triggerUpdate := &glue.TriggerUpdate{
Actions: expandGlueActions(d.Get("actions").([]interface{})),
}
Expand Down
2 changes: 1 addition & 1 deletion aws/resource_aws_iam_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func resourceAwsIamGroupReadResult(d *schema.ResourceData, group *iam.Group) err
}

func resourceAwsIamGroupUpdate(d *schema.ResourceData, meta interface{}) error {
if d.HasChange("name") || d.HasChange("path") {
if d.HasChanges("name", "path") {
iamconn := meta.(*AWSClient).iamconn
on, nn := d.GetChange("name")
_, np := d.GetChange("path")
Expand Down
2 changes: 1 addition & 1 deletion aws/resource_aws_iam_user.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ func resourceAwsIamUserRead(d *schema.ResourceData, meta interface{}) error {
func resourceAwsIamUserUpdate(d *schema.ResourceData, meta interface{}) error {
iamconn := meta.(*AWSClient).iamconn

if d.HasChange("name") || d.HasChange("path") {
if d.HasChanges("name", "path") {
on, nn := d.GetChange("name")
_, np := d.GetChange("path")

Expand Down
Loading