Skip to content

Latest commit

 

History

History
152 lines (141 loc) · 5.46 KB

caps.md

File metadata and controls

152 lines (141 loc) · 5.46 KB

Caps List

In Terraform AWS Provider code, we have two guiding principles for capitalization in function, constant, and variable names:

  1. We use Go-idiomatic MixedCaps, with idiomatic treatment of initialisms.
  2. We follow AWS's preferred capitalization for service names (e.g., "SageMaker" rather than "Sagemaker").

For principle 1, the golang/go Go Code Review Comments are instructive:

Words in names that are initialisms or acronyms (e.g. "URL" or "NATO") have a consistent case. For example, "URL" should appear as "URL" or "url" (as in "urlPony", or "URLPony"), never as "Url". As an example: ServeHTTP not ServeHttp. For identifiers with multiple initialized "words", use for example "xmlHTTPRequest" or "XMLHTTPRequest".

This rule also applies to "ID" when it is short for "identifier" (which is pretty much all cases when it's not the "id" as in "ego", "superego"), so write "appID" instead of "appId".

For principle 2, take a look at the AWS website for a service to see the capitalization that AWS prefers. For example, GameLift rather than "Gamelift".

To help enforce these principles, we are using semgrep rules. Below, you will find a list of the specific caps cases we look for currently. This list is generated from the same source as the semgrep rules.

NOTE: Please do NOT add "Id" to the list. Use "ID" or "id", never "Id", but we have found linter enforcement of this initialism to be too error prone because of the number of false positives for "Id" (e.g., "Identifier").

NOTE: Capitalization rules are all found in the ".semgrep-caps-aws-ec2.yml" configuration file are named <Test#>-in-func-name, <Test#>-in-var-name, or <Test#>-in-const-name, where Test# comes from the table below.

NOTE: The Test# order is wonky because we need to match on longer names first. In the future, with an option to automatically correct problems, fixing the longest possible initialism first is important (e.g., HTTPS needs to be fixed before HTTP to avoid something like HTTPs).

The caps enforced are as follows:

Wrong Right Test#
Acl ACL caps1
Acm ACM caps1
AcmPca ACMPCA caps0
Acmpca ACMPCA caps0
Ami AMI caps1
Api API caps1
ApiGateway APIGateway caps0
Appconfig AppConfig caps0
Appmesh AppMesh caps0
Appsync AppSync caps0
Arn ARN caps1
Asg ASG caps2
Asn ASN caps2
Autoscaling AutoScaling caps0
Bgp BGP caps2
Byoip BYOIP caps0
Cidr CIDR caps1
Cloudformation CloudFormation caps0
Cloudfront CloudFront caps0
Cloudwatch CloudWatch caps0
Cmk CMK caps2
Cname CNAME caps0
Coip CoIP caps1
Cpu CPU caps2
Css CSS caps2
Csv CSV caps2
Dax DAX caps2
Db DB caps3
Dhcp DHCP caps1
Dkim DKIM caps1
Dlm DLM caps2
Dms DMS caps2
Dns DNS caps2
Dnssec DNSSEC caps0
DocDb DocDB caps0
Docdb DocDB caps0
DynamoDb DynamoDB caps0
Dynamodb DynamoDB caps0
Ebs EBS caps2
Ec2 EC2 caps2
Ecmp ECMP caps1
Ecr ECR caps2
Ecs ECS caps2
Efs EFS caps2
Eip EIP caps2
Eks EKS caps2
Elasticache ElastiCache caps0
ElasticSearch Elasticsearch caps0
Elb ELB caps2
Emr EMR caps2
Fifo FIFO caps1
Fms FMS caps2
Fqdns FQDNS caps0
FSX FSx caps2
Fsx FSx caps2
Gamelift GameLift caps0
Gcm GCM caps2
Gp2 GP2 caps2
Gp3 GP3 caps2
Graphql GraphQL caps0
Grpc GRPC caps1
Guardduty GuardDuty caps0
Haproxy HAProxy caps0
Hsm HSM caps2
Http HTTP caps1
Https HTTPS caps0
Hvm HVM caps2
Iam IAM caps2
Iot IoT caps2
Ip IP caps3
Ipam IPAM caps1
Ipset IPSet caps1
Iscsi iSCSI caps1
Jdbc JDBC caps1
Json JSON caps1
Kms KMS caps2
Mfa MFA caps3
Msk MSK caps3
Mwaa MWAA caps1
Mysql MySQL caps1
Nfs NFS caps3
Oauth OAuth caps1
Oidc OIDC caps1
Opsworks OpsWorks caps0
Php PHP caps3
Pitr PITR caps1
Posix POSIX caps1
Precheck PreCheck caps0
Qldb QLDB caps1
Rabbitmq RabbitMQ caps0
Rds RDS caps3
Rfc RFC caps3
Sagemaker SageMaker caps0
Sasl SASL caps1
Sdk SDK caps3
Sfn SFN caps3
Smb SMB caps3
Sms SMS caps3
Smtp SMTP caps1
Sns SNS caps3
Sql SQL caps3
Sqs SQS caps3
Ssh SSH caps3
Ssl SSL caps3
Ssm SSM caps3
Sso SSO caps3
Sts STS caps3
Swf SWF caps3
Tcp TCP caps3
Tls TLS caps3
Ttl TTL caps3
Uri URI caps3
Url URL caps3
Vgw VGW caps3
Voip VoIP caps1
Vpc VPC caps3
Vpn VPN caps3
Waf WAF caps3
Wafv2 WAFV2 caps1
Worklink WorkLink caps0
Workspaces WorkSpaces caps0
Xray XRay caps1
Xss XSS caps3
Yaml YAML caps1