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

Tech debt: Simplify code using 'flattenStringSet' #6867

Closed
ewbankkit opened this issue Dec 16, 2018 · 3 comments
Closed

Tech debt: Simplify code using 'flattenStringSet' #6867

ewbankkit opened this issue Dec 16, 2018 · 3 comments
Labels
provider Pertains to the provider itself, rather than any interaction with AWS. technical-debt Addresses areas of the codebase that need refactoring or redesign.

Comments

@ewbankkit
Copy link
Contributor

ewbankkit commented Dec 16, 2018

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

The flattenStringSet convenience function was added in #6764.
We can now replace all occurrences of

schema.NewSet(schema.HashString, flattenStringList(list))

with

flattenStringSet(list)
@ewbankkit
Copy link
Contributor Author

$ grep 'schema.NewSet(schema.HashString, flattenStringList' *.go
cloudfront_distribution_configuration_structure.go:		return schema.NewSet(schema.HashString, flattenStringList(am.Items))
cloudfront_distribution_configuration_structure.go:		return schema.NewSet(schema.HashString, flattenStringList(cm.Items))
data_source_aws_cloudformation_stack.go:		d.Set("notification_arns", schema.NewSet(schema.HashString, flattenStringList(stack.NotificationARNs)))
data_source_aws_cloudformation_stack.go:		d.Set("capabilities", schema.NewSet(schema.HashString, flattenStringList(stack.Capabilities)))
data_source_aws_efs_mount_target.go:	err = d.Set("security_groups", schema.NewSet(schema.HashString, flattenStringList(sgResp.SecurityGroups)))
datasync.go:		"security_group_arns": schema.NewSet(schema.HashString, flattenStringList(ec2Config.SecurityGroupArns)),
datasync.go:		"agent_arns": schema.NewSet(schema.HashString, flattenStringList(onPremConfig.AgentArns)),
resource_aws_batch_compute_environment.go:	m["instance_type"] = schema.NewSet(schema.HashString, flattenStringList(computeResource.InstanceTypes))
resource_aws_batch_compute_environment.go:	m["security_group_ids"] = schema.NewSet(schema.HashString, flattenStringList(computeResource.SecurityGroupIds))
resource_aws_batch_compute_environment.go:	m["subnets"] = schema.NewSet(schema.HashString, flattenStringList(computeResource.Subnets))
resource_aws_cloudformation_stack.go:		err = d.Set("notification_arns", schema.NewSet(schema.HashString, flattenStringList(stack.NotificationARNs)))
resource_aws_cloudformation_stack.go:		err = d.Set("capabilities", schema.NewSet(schema.HashString, flattenStringList(stack.Capabilities)))
resource_aws_cloudwatch_event_target.go:	result["security_groups"] = schema.NewSet(schema.HashString, flattenStringList(nc.AwsvpcConfiguration.SecurityGroups))
resource_aws_cloudwatch_event_target.go:	result["subnets"] = schema.NewSet(schema.HashString, flattenStringList(nc.AwsvpcConfiguration.Subnets))
resource_aws_codebuild_project.go:		values["subnets"] = schema.NewSet(schema.HashString, flattenStringList(vpcConfig.Subnets))
resource_aws_codebuild_project.go:		values["security_group_ids"] = schema.NewSet(schema.HashString, flattenStringList(vpcConfig.SecurityGroupIds))
resource_aws_codedeploy_deployment_group.go:		item["trigger_events"] = schema.NewSet(schema.HashString, flattenStringList(tc.TriggerEvents))
resource_aws_codedeploy_deployment_group.go:		item["events"] = schema.NewSet(schema.HashString, flattenStringList(config.Events))
resource_aws_codedeploy_deployment_group.go:		item["alarms"] = schema.NewSet(schema.HashString, flattenStringList(names))
resource_aws_codedeploy_deployment_group.go:		"listener_arns": schema.NewSet(schema.HashString, flattenStringList(trafficRoute.ListenerArns)),
resource_aws_directory_service_directory.go:		d.Set("dns_ip_addresses", schema.NewSet(schema.HashString, flattenStringList(dir.ConnectSettings.ConnectIps)))
resource_aws_directory_service_directory.go:		d.Set("dns_ip_addresses", schema.NewSet(schema.HashString, flattenStringList(dir.DnsIpAddrs)))
resource_aws_ecs_service.go:	result["security_groups"] = schema.NewSet(schema.HashString, flattenStringList(nc.AwsvpcConfiguration.SecurityGroups))
resource_aws_ecs_service.go:	result["subnets"] = schema.NewSet(schema.HashString, flattenStringList(nc.AwsvpcConfiguration.Subnets))
resource_aws_efs_mount_target.go:	err = d.Set("security_groups", schema.NewSet(schema.HashString, flattenStringList(sgResp.SecurityGroups)))
resource_aws_eks_cluster.go:		"security_group_ids": schema.NewSet(schema.HashString, flattenStringList(vpcConfig.SecurityGroupIds)),
resource_aws_eks_cluster.go:		"subnet_ids":         schema.NewSet(schema.HashString, flattenStringList(vpcConfig.SubnetIds)),
resource_aws_s3_bucket_notification.go:		conf["events"] = schema.NewSet(schema.HashString, flattenStringList(notification.Events))
resource_aws_s3_bucket_notification.go:		conf["events"] = schema.NewSet(schema.HashString, flattenStringList(notification.Events))
resource_aws_s3_bucket_notification.go:		conf["events"] = schema.NewSet(schema.HashString, flattenStringList(notification.Events))
resource_aws_storagegateway_nfs_file_share.go:	if err := d.Set("client_list", schema.NewSet(schema.HashString, flattenStringList(fileshare.ClientList))); err != nil {
resource_aws_storagegateway_smb_file_share.go:	if err := d.Set("invalid_user_list", schema.NewSet(schema.HashString, flattenStringList(fileshare.InvalidUserList))); err != nil {
resource_aws_storagegateway_smb_file_share.go:	if err := d.Set("valid_user_list", schema.NewSet(schema.HashString, flattenStringList(fileshare.ValidUserList))); err != nil {
structure.go:	return schema.NewSet(schema.HashString, flattenStringList(list))
structure.go:		m["availability_zones"] = schema.NewSet(schema.HashString, flattenStringList(o.AvailabilityZones))
structure.go:		m["security_group_ids"] = schema.NewSet(schema.HashString, flattenStringList(o.SecurityGroupIds))
structure.go:		m["subnet_ids"] = schema.NewSet(schema.HashString, flattenStringList(o.SubnetIds))
structure.go:		m["resource_types"] = schema.NewSet(schema.HashString, flattenStringList(g.ResourceTypes))
structure.go:	settings["subnet_ids"] = schema.NewSet(schema.HashString, flattenStringList(s.SubnetIds))
structure.go:	settings["subnet_ids"] = schema.NewSet(schema.HashString, flattenStringList(s.SubnetIds))
structure.go:	settings["security_group_ids"] = schema.NewSet(schema.HashString, flattenStringList(s.SecurityGroupIds))
structure.go:	settings["customer_dns_ips"] = schema.NewSet(schema.HashString, flattenStringList(customerDnsIps))
structure.go:	settings["connect_ips"] = schema.NewSet(schema.HashString, flattenStringList(s.ConnectIps))
structure.go:	settings["subnet_ids"] = schema.NewSet(schema.HashString, flattenStringList(s.SubnetIds))
structure.go:		m["compliance_resource_types"] = schema.NewSet(schema.HashString, flattenStringList(scope.ComplianceResourceTypes))
structure.go:			m["groups"] = schema.NewSet(schema.HashString, flattenStringList(u.Groups))

@ewbankkit
Copy link
Contributor Author

All relevant code has now been modified.

@ghost
Copy link

ghost commented Feb 11, 2021

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked as resolved and limited conversation to collaborators Feb 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
provider Pertains to the provider itself, rather than any interaction with AWS. technical-debt Addresses areas of the codebase that need refactoring or redesign.
Projects
None yet
Development

No branches or pull requests

3 participants