├── .gitignore ├── LICENSE ├── Makefile ├── README.md ├── ftdetect └── terraform.vim ├── indent └── terraform.vim ├── syntax └── terraform.vim └── templates └── syntax └── terraform.vim /.gitignore: -------------------------------------------------------------------------------- 1 | tmp/ 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Kevin Le 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | GOPATH ?= ~/go 2 | providers := $(wildcard $(GOPATH)/src/github.com/hashicorp/terraform/builtin/providers/*/provider.go) 3 | resource_list := tmp/resources.txt 4 | data_source_list := tmp/data_sources.txt 5 | syntax := syntax/terraform.vim 6 | template_warning := \" GENERATED FROM MAKEFILE, DO NOT EDIT 7 | 8 | default: $(syntax) 9 | 10 | clean: 11 | rm $(syntax) 12 | rm -rf tmp/ 13 | 14 | $(resource_list): tmp/ 15 | rm -f $(resource_list) $(data_source_list) 16 | for file in $(providers); do \ 17 | resource=`grep -E ":\s+resource" "$$file" | cut -f 2 -d '"'`; \ 18 | echo "$$resource" >> $(resource_list); \ 19 | data_source=`grep -E ":\s+dataSource" "$$file" | cut -f 2 -d '"'`; \ 20 | echo "$$data_source" >> $(data_source_list); \ 21 | done 22 | 23 | $(syntax): $(resource_list) 24 | echo "$(template_warning)" > $(syntax) 25 | cat templates/$(syntax) | sed -e 's/RESOURCES/$(shell cat ${resource_list})/' | \ 26 | sed -e 's/DATA_SOURCES/$(shell cat ${data_source_list})/' >> $(syntax) 27 | 28 | tmp/: 29 | mkdir -p tmp/ 30 | 31 | .PHONY: clean default 32 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | vim-terraform 2 | ============= 3 | Syntax and indentation files for HashiCorp's [Terraform](https://www.terraform.io/). 4 | -------------------------------------------------------------------------------- /ftdetect/terraform.vim: -------------------------------------------------------------------------------- 1 | au BufRead,BufNewFile *.tf,*.tfvars setlocal filetype=terraform 2 | au BufRead,BufNewFile *.tfstate setlocal filetype=javascript 3 | -------------------------------------------------------------------------------- /indent/terraform.vim: -------------------------------------------------------------------------------- 1 | " Only load this indent file when no other was loaded. 2 | if exists("b:did_indent") 3 | finish 4 | endif 5 | let b:did_indent = 1 6 | 7 | setlocal smartindent 8 | 9 | " override the tf.vim indent file 10 | set indentexpr= 11 | 12 | " prevent # from being shunted to the first column 13 | inoremap # X# 14 | -------------------------------------------------------------------------------- /syntax/terraform.vim: -------------------------------------------------------------------------------- 1 | " GENERATED FROM MAKEFILE, DO NOT EDIT 2 | " Forked from Larry Gilbert's syntax file 3 | " github.com/L2G/vim-syntax-terraform 4 | 5 | if exists("b:current_syntax") 6 | finish 7 | endif 8 | 9 | syn case match 10 | 11 | syn keyword terraSection connection output provider variable 12 | syn keyword terraValueBool true false on off yes no 13 | 14 | """ resource 15 | 16 | syn keyword terraResourceTypeBI alicloud_instance alicloud_disk alicloud_disk_attachment alicloud_security_group alicloud_security_group_rule alicloud_vpc alicloud_nat_gateway alicloud_subnet alicloud_vswitch alicloud_route_entry alicloud_eip alicloud_eip_association alicloud_slb alicloud_slb_attachment arukas_container atlas_artifact aws_alb aws_alb_listener aws_alb_listener_rule aws_alb_target_group aws_alb_target_group_attachment aws_ami aws_ami_copy aws_ami_from_instance aws_ami_launch_permission aws_api_gateway_account aws_api_gateway_api_key aws_api_gateway_authorizer aws_api_gateway_base_path_mapping aws_api_gateway_client_certificate aws_api_gateway_deployment aws_api_gateway_domain_name aws_api_gateway_integration aws_api_gateway_integration_response aws_api_gateway_method aws_api_gateway_method_response aws_api_gateway_model aws_api_gateway_resource aws_api_gateway_rest_api aws_app_cookie_stickiness_policy aws_appautoscaling_target aws_appautoscaling_policy aws_autoscaling_attachment aws_autoscaling_group aws_autoscaling_notification aws_autoscaling_policy aws_autoscaling_schedule aws_cloudformation_stack aws_cloudfront_distribution aws_cloudfront_origin_access_identity aws_cloudtrail aws_cloudwatch_event_rule aws_cloudwatch_event_target aws_cloudwatch_log_destination aws_cloudwatch_log_destination_policy aws_cloudwatch_log_group aws_cloudwatch_log_metric_filter aws_cloudwatch_log_stream aws_cloudwatch_log_subscription_filter aws_config_config_rule aws_config_configuration_recorder aws_config_configuration_recorder_status aws_config_delivery_channel aws_autoscaling_lifecycle_hook aws_cloudwatch_metric_alarm aws_codedeploy_app aws_codedeploy_deployment_config aws_codedeploy_deployment_group aws_codecommit_repository aws_codecommit_trigger aws_codebuild_project aws_codepipeline aws_customer_gateway aws_db_event_subscription aws_db_instance aws_db_option_group aws_db_parameter_group aws_db_security_group aws_db_subnet_group aws_directory_service_directory aws_dms_certificate aws_dms_endpoint aws_dms_replication_instance aws_dms_replication_subnet_group aws_dms_replication_task aws_dynamodb_table aws_ebs_snapshot aws_ebs_volume aws_ecr_repository aws_ecr_repository_policy aws_ecs_cluster aws_ecs_service aws_ecs_task_definition aws_efs_file_system aws_efs_mount_target aws_egress_only_internet_gateway aws_eip aws_eip_association aws_elasticache_cluster aws_elasticache_parameter_group aws_elasticache_replication_group aws_elasticache_security_group aws_elasticache_subnet_group aws_elastic_beanstalk_application aws_elastic_beanstalk_application_version aws_elastic_beanstalk_configuration_template aws_elastic_beanstalk_environment aws_elasticsearch_domain aws_elasticsearch_domain_policy aws_elastictranscoder_pipeline aws_elastictranscoder_preset aws_elb aws_elb_attachment aws_emr_cluster aws_emr_instance_group aws_flow_log aws_glacier_vault aws_iam_access_key aws_iam_account_password_policy aws_iam_group_policy aws_iam_group aws_iam_group_membership aws_iam_group_policy_attachment aws_iam_instance_profile aws_iam_policy aws_iam_policy_attachment aws_iam_role_policy_attachment aws_iam_role_policy aws_iam_role aws_iam_saml_provider aws_iam_server_certificate aws_iam_user_policy_attachment aws_iam_user_policy aws_iam_user_ssh_key aws_iam_user aws_iam_user_login_profile aws_inspector_assessment_target aws_inspector_assessment_template aws_inspector_resource_group aws_instance aws_internet_gateway aws_key_pair aws_kinesis_firehose_delivery_stream aws_kinesis_stream aws_kms_alias aws_kms_key aws_lambda_function aws_lambda_event_source_mapping aws_lambda_alias aws_lambda_permission aws_launch_configuration aws_lightsail_domain aws_lightsail_instance aws_lightsail_key_pair aws_lb_cookie_stickiness_policy aws_load_balancer_policy aws_load_balancer_backend_server_policy aws_load_balancer_listener_policy aws_lb_ssl_negotiation_policy aws_main_route_table_association aws_nat_gateway aws_network_acl aws_default_network_acl aws_default_route_table aws_network_acl_rule aws_network_interface aws_opsworks_application aws_opsworks_stack aws_opsworks_java_app_layer aws_opsworks_haproxy_layer aws_opsworks_static_web_layer aws_opsworks_php_app_layer aws_opsworks_rails_app_layer aws_opsworks_nodejs_app_layer aws_opsworks_memcached_layer aws_opsworks_mysql_layer aws_opsworks_ganglia_layer aws_opsworks_custom_layer aws_opsworks_instance aws_opsworks_user_profile aws_opsworks_permission aws_opsworks_rds_db_instance aws_placement_group aws_proxy_protocol_policy aws_rds_cluster aws_rds_cluster_instance aws_rds_cluster_parameter_group aws_redshift_cluster aws_redshift_security_group aws_redshift_parameter_group aws_redshift_subnet_group aws_route53_delegation_set aws_route53_record aws_route53_zone_association aws_route53_zone aws_route53_health_check aws_route aws_route_table aws_route_table_association aws_ses_active_receipt_rule_set aws_ses_receipt_filter aws_ses_receipt_rule aws_ses_receipt_rule_set aws_ses_configuration_set aws_ses_event_destination aws_s3_bucket aws_s3_bucket_policy aws_s3_bucket_object aws_s3_bucket_notification aws_default_security_group aws_security_group aws_security_group_rule aws_simpledb_domain aws_ssm_activation aws_ssm_association aws_ssm_document aws_spot_datafeed_subscription aws_spot_instance_request aws_spot_fleet_request aws_sqs_queue aws_sqs_queue_policy aws_snapshot_create_volume_permission aws_sns_topic aws_sns_topic_policy aws_sns_topic_subscription aws_sfn_activity aws_sfn_state_machine aws_subnet aws_volume_attachment aws_vpc_dhcp_options_association aws_vpc_dhcp_options aws_vpc_peering_connection aws_vpc_peering_connection_accepter aws_vpc aws_vpc_endpoint aws_vpc_endpoint_route_table_association aws_vpn_connection aws_vpn_connection_route aws_vpn_gateway aws_vpn_gateway_attachment aws_waf_byte_match_set aws_waf_ipset aws_waf_rule aws_waf_size_constraint_set aws_waf_web_acl aws_waf_xss_match_set aws_waf_sql_injection_match_set azure_instance azure_affinity_group azure_data_disk azure_sql_database_server azure_sql_database_server_firewall_rule azure_sql_database_service azure_hosted_service azure_storage_service azure_storage_container azure_storage_blob azure_storage_queue azure_virtual_network azure_dns_server azure_local_network_connection azure_security_group azure_security_group_rule azurerm_availability_set azurerm_cdn_endpoint azurerm_cdn_profile azurerm_container_registry azurerm_container_service azurerm_eventhub azurerm_eventhub_authorization_rule azurerm_eventhub_consumer_group azurerm_eventhub_namespace azurerm_lb azurerm_lb_backend_address_pool azurerm_lb_nat_rule azurerm_lb_nat_pool azurerm_lb_probe azurerm_lb_rule azurerm_key_vault azurerm_local_network_gateway azurerm_network_interface azurerm_network_security_group azurerm_network_security_rule azurerm_public_ip azurerm_redis_cache azurerm_route azurerm_route_table azurerm_servicebus_namespace azurerm_servicebus_subscription azurerm_servicebus_topic azurerm_storage_account azurerm_storage_blob azurerm_storage_container azurerm_storage_share azurerm_storage_queue azurerm_storage_table azurerm_subnet azurerm_template_deployment azurerm_traffic_manager_endpoint azurerm_traffic_manager_profile azurerm_virtual_machine_extension azurerm_virtual_machine azurerm_virtual_machine_scale_set azurerm_virtual_network azurerm_virtual_network_peering azurerm_dns_a_record azurerm_dns_aaaa_record azurerm_dns_cname_record azurerm_dns_mx_record azurerm_dns_ns_record azurerm_dns_srv_record azurerm_dns_txt_record azurerm_dns_zone azurerm_resource_group azurerm_search_service azurerm_sql_database azurerm_sql_firewall_rule azurerm_sql_server bitbucket_hook bitbucket_default_reviewers bitbucket_repository chef_acl chef_client chef_cookbook chef_data_bag chef_data_bag_item chef_environment chef_node chef_role circonus_check circonus_contact_group circonus_graph circonus_metric circonus_metric_cluster circonus_rule_set clc_server clc_group clc_public_ip clc_load_balancer clc_load_balancer_pool cloudflare_record cloudstack_affinity_group cloudstack_disk cloudstack_egress_firewall cloudstack_firewall cloudstack_instance cloudstack_ipaddress cloudstack_loadbalancer_rule cloudstack_network cloudstack_network_acl cloudstack_network_acl_rule cloudstack_nic cloudstack_port_forward cloudstack_private_gateway cloudstack_secondary_ipaddress cloudstack_security_group cloudstack_security_group_rule cloudstack_ssh_keypair cloudstack_static_nat cloudstack_static_route cloudstack_template cloudstack_vpc cloudstack_vpn_connection cloudstack_vpn_customer_gateway cloudstack_vpn_gateway cobbler_distro cobbler_kickstart_file cobbler_profile cobbler_snippet cobbler_system datadog_monitor datadog_timeboard datadog_user digitalocean_domain digitalocean_droplet digitalocean_floating_ip digitalocean_loadbalancer digitalocean_record digitalocean_ssh_key digitalocean_tag digitalocean_volume dme_record dns_a_record_set dns_aaaa_record_set dns_cname_record dns_ptr_record dnsimple_record docker_container docker_image docker_network docker_volume dyn_record fastly_service_v1 github_team github_team_membership github_team_repository github_membership github_repository github_repository_collaborator github_issue_label google_compute_autoscaler google_compute_address google_compute_backend_service google_compute_disk google_compute_firewall google_compute_forwarding_rule google_compute_global_address google_compute_global_forwarding_rule google_compute_health_check google_compute_http_health_check google_compute_https_health_check google_compute_image google_compute_instance google_compute_instance_group google_compute_instance_group_manager google_compute_instance_template google_compute_network google_compute_project_metadata google_compute_region_backend_service google_compute_route google_compute_ssl_certificate google_compute_subnetwork google_compute_target_http_proxy google_compute_target_https_proxy google_compute_target_pool google_compute_url_map google_compute_vpn_gateway google_compute_vpn_tunnel google_container_cluster google_container_node_pool google_dns_managed_zone google_dns_record_set google_sql_database google_sql_database_instance google_sql_user google_project google_project_iam_policy google_project_services google_pubsub_topic google_pubsub_subscription google_service_account google_storage_bucket google_storage_bucket_acl google_storage_bucket_object google_storage_object_acl heroku_app heroku_addon heroku_domain heroku_drain heroku_cert icinga2_host icinga2_hostgroup icinga2_checkcommand icinga2_service ignition_config ignition_disk ignition_raid ignition_filesystem ignition_file ignition_systemd_unit ignition_networkd_unit ignition_user ignition_group influxdb_database influxdb_user influxdb_continuous_query librato_space librato_space_chart librato_alert librato_service logentries_log logentries_logset mailgun_domain mysql_database mysql_user mysql_grant newrelic_alert_channel newrelic_alert_condition newrelic_alert_policy newrelic_alert_policy_channel nomad_job null_resource openstack_blockstorage_volume_v1 openstack_blockstorage_volume_v2 openstack_blockstorage_volume_attach_v2 openstack_compute_instance_v2 openstack_compute_keypair_v2 openstack_compute_secgroup_v2 openstack_compute_servergroup_v2 openstack_compute_floatingip_v2 openstack_compute_floatingip_associate_v2 openstack_compute_volume_attach_v2 openstack_fw_firewall_v1 openstack_fw_policy_v1 openstack_fw_rule_v1 openstack_images_image_v2 openstack_lb_member_v1 openstack_lb_monitor_v1 openstack_lb_pool_v1 openstack_lb_vip_v1 openstack_lb_loadbalancer_v2 openstack_lb_listener_v2 openstack_lb_pool_v2 openstack_lb_member_v2 openstack_lb_monitor_v2 openstack_networking_network_v2 openstack_networking_subnet_v2 openstack_networking_floatingip_v2 openstack_networking_port_v2 openstack_networking_router_v2 openstack_networking_router_interface_v2 openstack_networking_router_route_v2 openstack_networking_secgroup_v2 openstack_networking_secgroup_rule_v2 openstack_objectstorage_container_v1 opsgenie_team opsgenie_user packet_device packet_ssh_key packet_project packet_volume pagerduty_addon pagerduty_user pagerduty_team pagerduty_service pagerduty_service_integration pagerduty_schedule pagerduty_escalation_policy postgresql_database postgresql_extension postgresql_schema postgresql_role powerdns_record profitbricks_datacenter profitbricks_ipblock profitbricks_firewall profitbricks_lan profitbricks_loadbalancer profitbricks_nic profitbricks_server profitbricks_volume rabbitmq_binding rabbitmq_exchange rabbitmq_permissions rabbitmq_policy rabbitmq_queue rabbitmq_user rabbitmq_vhost rancher_environment rancher_registration_token rancher_registry rancher_registry_credential rancher_stack random_id random_shuffle rundeck_project rundeck_job rundeck_private_key rundeck_public_key scaleway_server scaleway_ip scaleway_security_group scaleway_security_group_rule scaleway_volume scaleway_volume_attachment softlayer_virtual_guest softlayer_ssh_key spotinst_aws_group spotinst_subscription spotinst_healthcheck statuscake_test tls_private_key tls_locally_signed_cert tls_self_signed_cert tls_cert_request triton_firewall_rule triton_machine triton_key triton_vlan triton_fabric ultradns_dirpool ultradns_probe_http ultradns_probe_ping ultradns_record ultradns_tcpool vcd_network vcd_vapp vcd_firewall_rules vcd_dnat vcd_snat vsphere_file vsphere_folder vsphere_virtual_disk vsphere_virtual_machine 17 | syn keyword terraDataSourceTypeBI alicloud_images alicloud_regions alicloud_zones alicloud_instance_types archive_file atlas_artifact aws_acm_certificate aws_alb aws_alb_listener aws_ami aws_autoscaling_groups aws_availability_zone aws_availability_zones aws_billing_service_account aws_caller_identity aws_canonical_user_id aws_cloudformation_stack aws_db_instance aws_ebs_snapshot aws_ebs_volume aws_ecs_cluster aws_ecs_container_definition aws_ecs_task_definition aws_eip aws_elb_hosted_zone_id aws_elb_service_account aws_iam_account_alias aws_iam_policy_document aws_iam_server_certificate aws_instance aws_ip_ranges aws_kms_secret aws_partition aws_prefix_list aws_redshift_service_account aws_region aws_route_table aws_route53_zone aws_s3_bucket_object aws_sns_topic aws_subnet aws_security_group aws_vpc aws_vpc_endpoint aws_vpc_endpoint_service aws_vpc_peering_connection aws_vpn_gateway azurerm_client_config circonus_account circonus_collector docker_registry_image external fastly_ip_ranges google_iam_policy google_compute_zones newrelic_application ns1_datasource null_data_source openstack_images_image_v2 openstack_networking_network_v2 opsgenie_user pagerduty_user pagerduty_schedule pagerduty_escalation_policy pagerduty_vendor profitbricks_datacenter profitbricks_location profitbricks_image scaleway_bootscript scaleway_image template_file template_cloudinit_config terraform_remote_state 18 | 19 | syn keyword terraTodo contained TODO FIXME XXX BUG 20 | syn cluster terraCommentGroup contains=terraTodo 21 | syn region terraComment start="/\*" end="\*/" contains=@terraCommentGroup,@Spell 22 | syn region terraComment start="#" end="$" contains=@terraCommentGroup,@Spell 23 | 24 | syn match terraResource /\/ nextgroup=terraResourceTypeStr skipwhite 25 | syn region terraResourceTypeStr start=/"/ end=/"/ contains=terraResourceTypeBI 26 | \ nextgroup=terraResourceName skipwhite 27 | syn region terraResourceName start=/"/ end=/"/ 28 | \ nextgroup=terraResourceBlock skipwhite 29 | 30 | syn match terraDataSource /\/ nextgroup=terraDataSourceTypeStr skipwhite 31 | syn region terraDataSourceTypeStr start=/"/ end=/"/ contains=terraDataSourceTypeBI 32 | \ nextgroup=terraDataSourceName skipwhite 33 | syn region terraDataSourceName start=/"/ end=/"/ 34 | \ nextgroup=terraDataSourceBlock skipwhite 35 | """ provider 36 | syn match terraProvider /\/ nextgroup=terraProviderName skipwhite 37 | syn region terraProviderName start=/"/ end=/"/ nextgroup=terraProviderBlock skipwhite 38 | 39 | """ misc. 40 | syn match terraValueDec "\<[0-9]\+\([kKmMgG]b\?\)\?\>" 41 | syn match terraValueHexaDec "\<0x[0-9a-f]\+\([kKmMgG]b\?\)\?\>" 42 | syn match terraBraces "[{}\[\]]" 43 | 44 | syn region terraValueString start=/\\\@/ nextgroup=terraResourceTypeStr skipwhite 24 | syn region terraResourceTypeStr start=/"/ end=/"/ contains=terraResourceTypeBI 25 | \ nextgroup=terraResourceName skipwhite 26 | syn region terraResourceName start=/"/ end=/"/ 27 | \ nextgroup=terraResourceBlock skipwhite 28 | 29 | syn match terraDataSource /\/ nextgroup=terraDataSourceTypeStr skipwhite 30 | syn region terraDataSourceTypeStr start=/"/ end=/"/ contains=terraDataSourceTypeBI 31 | \ nextgroup=terraDataSourceName skipwhite 32 | syn region terraDataSourceName start=/"/ end=/"/ 33 | \ nextgroup=terraDataSourceBlock skipwhite 34 | """ provider 35 | syn match terraProvider /\/ nextgroup=terraProviderName skipwhite 36 | syn region terraProviderName start=/"/ end=/"/ nextgroup=terraProviderBlock skipwhite 37 | 38 | """ misc. 39 | syn match terraValueDec "\<[0-9]\+\([kKmMgG]b\?\)\?\>" 40 | syn match terraValueHexaDec "\<0x[0-9a-f]\+\([kKmMgG]b\?\)\?\>" 41 | syn match terraBraces "[{}\[\]]" 42 | 43 | syn region terraValueString start=/\\\@