vim: add .vim/bundle/vim-terraform

This commit is contained in:
Dongsu Park 2017-05-19 14:02:51 +02:00
parent 9837c9bea5
commit 91936cfde7
18 changed files with 1367 additions and 0 deletions

View file

@ -0,0 +1,11 @@
root = true
[*]
indent_style = space
indent_size = 2
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.md]
trim_trailing_whitespace = false

1
.vim/bundle/vim-terraform/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/doc/tags

View file

@ -0,0 +1,21 @@
# vim-terraform CHANGELOG
## Version 1.2.1 (February 5, 2015)
- Block indentation fix (thanks imkira@github)
## Version 1.2.0 (December 12, 2014)
- Add Kevin Le's syntax highlighting
## Version 1.1.0 (December 11, 2014)
- Remove syntax highlighting; see README.md
## Version 1.0.1 (December 10, 2014)
- Make this work without the JSON plugin
## Version 1.0.0 (December 10, 2014)
- Initial release

View file

@ -0,0 +1,45 @@
# Contributor Code of Conduct
As contributors and maintainers of this project, and in the interest of
fostering an open and welcoming community, we pledge to respect all people who
contribute through reporting issues, posting feature requests, updating
documentation, submitting pull requests or patches, and other activities.
We are committed to making participation in this project a harassment-free
experience for everyone, regardless of level of experience, gender, gender
identity and expression, sexual orientation, disability, personal appearance,
body size, race, ethnicity, age, religion, or nationality.
Examples of unacceptable behavior by participants include:
- The use of sexualized language or imagery
- Personal attacks
- Trolling or insulting/derogatory comments
- Public or private harassment
- Publishing other's private information, such as physical or electronic
addresses, without explicit permission
- Other unethical or unprofessional conduct.
Project maintainers have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct. By adopting this Code of Conduct, project
maintainers commit themselves to fairly and consistently applying these
principles to every aspect of managing this project. Project maintainers who do
not follow or enforce the Code of Conduct may be permanently removed from the
project team.
This code of conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community.
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by opening an issue or contacting one or more of the project
maintainers.
This Code of Conduct is adapted from the [Contributor
Covenant](http://contributor-covenant.org), version 1.2.0, available at
<http://contributor-covenant.org/version/1/2/0/>

View file

@ -0,0 +1,35 @@
# Contributing To My Vim Plugins
I'm not a Vim wizard by any means, nor am I too proud to accept
contributions that improve my code, so if you think you have a problem,
improvement, or other contribution towards the betterment of Vim-kind,
please file an issue or, where appropriate, a pull request.
Before filing an issue, please read this article by my friends and
former colleagues at Viget:
<https://viget.com/extend/tips-for-writing-better-bug-reports>
Keep in mind that I'm not paid to write Vim plugins, so I'm doing this
in my spare time, which means it might take me a while to respond. If
you're not satisfied with my response to your problem with my free (as
in beer and in speech) software, I will give you triple your $0.00 back.
When filing a pull request, please explain what you're changing and why.
Please limit your changes to the specific thing you're fixing; it's
probably easiest for both of us if you isolate your change in a topic
branch that I can merge without pulling in other stuff. Please do not
update CHANGELOG, versions, etc.; I'll take care of that. I'll also add
you to the Credits list with my thanks.
All of my Vim plugins use the ISC license. If you submit a pull request,
I'll assume you are OK with any code you add being placed under that
same ISC license. If this is not the case for any reason, please let me
know why you can't tolerate the ISC license. I am 99.99% likely to
reject your change in that case, but I'll let you have your say.
This project is intended to be a safe, welcoming space for collaboration, and
contributors are expected to adhere to the [Contributor
Covenant](http://contributor-covenant.org) code of conduct.
Thanks for contributing!

View file

@ -0,0 +1,13 @@
Copyright (c) 2014-2016 Mark Cornick <mark@markcornick.com>
Permission to use, copy, modify, and/or distribute this software for any purpose
with or without fee is hereby granted, provided that the above copyright notice
and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED 'AS IS' AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
THIS SOFTWARE.

View file

@ -0,0 +1,95 @@
[![](https://img.shields.io/badge/Supports%20Terraform%20Version-%3E%3D0.9.3-blue.svg)](https://github.com/hashicorp/terraform/blob/v0.9.3/CHANGELOG.md)
# Call For Maintainers
This plugin, along with others like it, is now maintained by the
[HashiVim](http://hashivim.github.io/) organization, which is looking for
additional maintainers and contributors. See the HashiVim home page for
further information.
- - - -
# Overview: vim-terraform
This plugin adds a `:Terraform` command that runs terraform, with tab
completion of subcommands. It also sets up `*.tf`, `*.tfvars`, and
`*.tfstate` files to be highlighted as HCL, HCL, and JSON respectively.
For Terraform 0.6.15 or greater, this plugin also adds a `:TerraformFmt`
command that runs `terraform fmt` against the current buffer. Set
`g:terraform_fmt_on_save` to 1 to run `terraform fmt` automatically when
saving `*.tf` or `*.tfvars` files.
- - - -
# Installation
With [pathogen.vim](https://github.com/tpope/vim-pathogen) just do:
cd ~/.vim/bundle
git clone https://github.com/hashivim/vim-terraform.git
If you prefer to use something besides pathogen, go ahead.
- - - -
# Usage
Allow vim-terraform to override your `.vimrc` indentation syntax for matching files. Defaults to 0 which is off.
let g:terraform_align=1
If you use the [vim-commentary](https://github.com/tpope/vim-commentary) plugin, you should set the following option in your `~/.vimrc`. See [TOOLS-1](https://github.com/hashivim/vim-hashicorp-tools/pull/1) for more details.
autocmd FileType terraform setlocal commentstring=#%s
- - - -
# Updating vim-terraform
Note, this is only for maintainers of the `vim-terraform` project.
When a new version of Terraform drops, you can run the following where x.x.x is a version such as 0.8.7
./update_automagic.sh x.x.x
You will see the following truncated output
+) Extracting terraform-0.8.7.tar.gz
+) Running update_commands.rb
+) Running update_data_sources.rb
+) Running update_syntax.rb
+) Cleaning up after ourselves
On branch feature/run-helper-scripts-for-terraform-087/pgp
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: syntax/terraform.vim
At this point, add the modified files to a git branch and open a pull request.
git checkout -b "feature/update-to-terraform-$VERSION"
git add $FILE
git commit -m "Message about update"
git push
Add another maintainer to the pull request and await confirmation.
- - - -
# Credits
Syntax highlighting and indentation by Kevin Le (@bkad) based on prior work by
Larry Gilbert (@L2G). The rest originally written by Mark Cornick
<https://www.markcornick.com/> and contributors listed below. Licensed under the
ISC license.
Thanks to the following contributors:
- michael j talarczyk (@mijit)
- Koji Nakayama (@knakayama)
- Kris (@kostecky)
- Okumura Takahiro (@hfm)
- Paul Forman (@pforman)
- Lowe Schmidt (@lsc)
The `:TerraformFmt` command is adapted from
[vim-hclfmt](https://github.com/fatih/vim-hclfmt/blob/master/autoload/fmt.vim).
This project is intended to be a safe, welcoming space for collaboration, and
contributors are expected to adhere to the [Contributor
Covenant](http://contributor-covenant.org) code of conduct.

View file

@ -0,0 +1,57 @@
if !exists('g:terraform_align')
let g:terraform_align = 0
endif
if g:terraform_align && exists(':Tabularize')
inoremap <buffer> <silent> = =<Esc>:call <SID>terraformalign()<CR>a
function! s:terraformalign()
let p = '^.*=[^>]*$'
if exists(':Tabularize') && getline('.') =~# '^.*=' && (getline(line('.')-1) =~# p || getline(line('.')+1) =~# p)
let column = strlen(substitute(getline('.')[0:col('.')],'[^=]','','g'))
let position = strlen(matchstr(getline('.')[0:col('.')],'.*=\s*\zs.*'))
Tabularize/=/l1
normal! 0
call search(repeat('[^=]*=',column).'\s\{-\}'.repeat('.',position),'ce',line('.'))
endif
endfunction
endif
function! TerraformFolds()
let thisline = getline(v:lnum)
if match(thisline, '^resource') >= 0
return ">1"
elseif match(thisline, '^provider') >= 0
return ">1"
elseif match(thisline, '^module') >= 0
return ">1"
elseif match(thisline, '^variable') >= 0
return ">1"
elseif match(thisline, '^output') >= 0
return ">1"
else
return "="
endif
endfunction
setlocal foldmethod=expr
setlocal foldexpr=TerraformFolds()
setlocal foldlevel=1
function! TerraformFoldText()
let foldsize = (v:foldend-v:foldstart)
return getline(v:foldstart).' ('.foldsize.' lines)'
endfunction
setlocal foldtext=TerraformFoldText()
"inoremap <space> <C-O>za
nnoremap <space> za
onoremap <space> <C-C>za
vnoremap <space> zf
" Match the identation put in place by Hashicorp and :TerraformFmt, https://github.com/hashivim/vim-terraform/issues/21
if get(g:, "terraform_align", 1)
setlocal tabstop=2
setlocal softtabstop=2
setlocal shiftwidth=2
endif

View file

@ -0,0 +1,14 @@
*terraform.txt* basic vim/terraform integration
Author: HashiVim <https://github.com/hashivim>
License: ISC license
Repo: https://github.com/hashivim/vim-terraform
COMMANDS *terraform*
This command is only available if terraform is in your PATH.
*terraform-:terraform*
:Terraform [args] Invoke an arbitrary terraform command.
vim:tw=78:et:ft=help:norl:

View file

@ -0,0 +1,3 @@
au BufRead,BufNewFile *.tf setlocal filetype=terraform
au BufRead,BufNewFile *.tfvars setlocal filetype=terraform
au BufRead,BufNewFile *.tfstate setlocal filetype=javascript

View file

@ -0,0 +1,44 @@
if exists("b:did_indent")
finish
endif
let b:did_indent = 1
setlocal nolisp
setlocal autoindent
setlocal indentexpr=TerraformIndent(v:lnum)
setlocal indentkeys+=<:>,0=},0=)
if exists("*TerraformIndent")
finish
endif
function! TerraformIndent(lnum)
" previous non-blank line
let prevlnum = prevnonblank(a:lnum-1)
" beginning of file?
if prevlnum == 0
return 0
endif
" previous line without comments
let prevline = substitute(getline(prevlnum), '//.*$', '', '')
let previndent = indent(prevlnum)
let thisindent = previndent
" block open?
if prevline =~ '[\[{]\s*$'
let thisindent += &sw
endif
" current line without comments
let thisline = substitute(getline(a:lnum), '//.*$', '', '')
" block close?
if thisline =~ '^\s*[\]}]'
let thisindent -= &sw
endif
return thisindent
endfunction

View file

@ -0,0 +1,69 @@
" terraform.vim - basic vim/terraform integration
" Maintainer: HashiVim <https://github.com/hashivim>
if exists("g:loaded_terraform") || v:version < 700 || &cp || !executable('terraform')
finish
endif
let g:loaded_terraform = 1
if !exists("g:terraform_fmt_on_save")
let g:terraform_fmt_on_save = 0
endif
function! s:commands(A, L, P)
return join([
\ "apply",
\ "console",
\ "destroy",
\ "env",
\ "fmt",
\ "get",
\ "graph",
\ "import",
\ "init",
\ "output",
\ "plan",
\ "push",
\ "refresh",
\ "show",
\ "taint",
\ "untaint",
\ "validate",
\ "version",
\ "debug",
\ "force-unlock",
\ "state"
\ ], "\n")
endfunction
" Adapted from vim-hclfmt:
" https://github.com/fatih/vim-hclfmt/blob/master/autoload/fmt.vim
function! terraform#fmt()
let l:curw = winsaveview()
let l:tmpfile = tempname()
call writefile(getline(1, "$"), l:tmpfile)
let output = system("terraform fmt -write " . l:tmpfile)
if v:shell_error == 0
try | silent undojoin | catch | endtry
call rename(l:tmpfile, expand("%"))
silent edit!
let &syntax = &syntax
else
echo output
call delete(l:tmpfile)
endif
call winrestview(l:curw)
endfunction
augroup terraform
autocmd!
autocmd VimEnter *
\ command! -nargs=+ -complete=custom,s:commands Terraform execute '!terraform '.<q-args>. ' -no-color'
autocmd VimEnter * command! -nargs=0 TerraformFmt call terraform#fmt()
if get(g:, "terraform_fmt_on_save", 1)
autocmd BufWritePre *.tf call terraform#fmt()
autocmd BufWritePre *.tfvars call terraform#fmt()
endif
augroup END
" vim:set et sw=2:

View file

@ -0,0 +1,795 @@
" Forked from Larry Gilbert's syntax file
" github.com/L2G/vim-syntax-terraform
if exists("b:current_syntax")
finish
endif
syn case match
syn keyword terraSection connection output provider variable data terraform
syn keyword terraValueBool true false on off yes no
""" data
syn keyword terraDataTypeBI
\ alicloud_images
\ alicloud_instance_types
\ alicloud_regions
\ alicloud_zones
\ 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_role
\ aws_iam_server_certificate
\ aws_instance
\ aws_ip_ranges
\ aws_kms_secret
\ aws_partition
\ aws_prefix_list
\ aws_redshift_service_account
\ aws_region
\ aws_route53_zone
\ aws_route_table
\ aws_s3_bucket_object
\ aws_security_group
\ aws_sns_topic
\ aws_subnet
\ aws_subnet_ids
\ aws_vpc
\ aws_vpc_endpoint
\ aws_vpc_endpoint_service
\ aws_vpc_peering_connection
\ aws_vpn_gateway
\ azurerm_client_config
\ circonus_account
\ circonus_collector
\ consul_agent_self
\ consul_catalog_nodes
\ consul_catalog_service
\ consul_catalog_services
\ consul_keys
\ dns_a_record_set
\ dns_cname_record_set
\ dns_txt_record_set
\ docker_registry_image
\ external
\ fastly_ip_ranges
\ google_compute_zones
\ google_iam_policy
\ newrelic_application
\ ns1_datasource
\ null_data_source
\ openstack_images_image_v2
\ openstack_networking_network_v2
\ opsgenie_user
\ pagerduty_escalation_policy
\ pagerduty_schedule
\ pagerduty_user
\ pagerduty_vendor
\ profitbricks_datacenter
\ profitbricks_image
\ profitbricks_location
\ scaleway_bootscript
\ scaleway_image
\ template_cloudinit_config
\ template_file
\ terraform_remote_state
""" end data sources
""" resource
syn keyword terraResourceTypeBI
\ alicloud_db_instance
\ alicloud_disk
\ alicloud_disk_attachment
\ alicloud_eip
\ alicloud_eip_association
\ alicloud_instance
\ alicloud_nat_gateway
\ alicloud_route_entry
\ alicloud_security_group
\ alicloud_security_group_rule
\ alicloud_slb
\ alicloud_slb_attachment
\ alicloud_subnet
\ alicloud_vpc
\ alicloud_vswitch
\ 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_method_settings
\ aws_api_gateway_model
\ aws_api_gateway_resource
\ aws_api_gateway_rest_api
\ aws_api_gateway_stage
\ aws_api_gateway_usage_plan
\ aws_api_gateway_usage_plan_key
\ aws_app_cookie_stickiness_policy
\ aws_appautoscaling_policy
\ aws_appautoscaling_target
\ aws_autoscaling_attachment
\ aws_autoscaling_group
\ aws_autoscaling_lifecycle_hook
\ 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_cloudwatch_metric_alarm
\ aws_codebuild_project
\ aws_codecommit_repository
\ aws_codecommit_trigger
\ aws_codedeploy_app
\ aws_codedeploy_deployment_config
\ aws_codedeploy_deployment_group
\ aws_codepipeline
\ aws_config_config_rule
\ aws_config_configuration_recorder
\ aws_config_configuration_recorder_status
\ aws_config_delivery_channel
\ 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_default_network_acl
\ aws_default_route_table
\ aws_default_security_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_elastic_beanstalk_application
\ aws_elastic_beanstalk_application_version
\ aws_elastic_beanstalk_configuration_template
\ aws_elastic_beanstalk_environment
\ aws_elasticache_cluster
\ aws_elasticache_parameter_group
\ aws_elasticache_replication_group
\ aws_elasticache_security_group
\ aws_elasticache_subnet_group
\ 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_alias
\ aws_iam_account_password_policy
\ aws_iam_group
\ aws_iam_group_membership
\ aws_iam_group_policy
\ aws_iam_group_policy_attachment
\ aws_iam_instance_profile
\ aws_iam_openid_connect_provider
\ aws_iam_policy
\ aws_iam_policy_attachment
\ aws_iam_role
\ aws_iam_role_policy
\ aws_iam_role_policy_attachment
\ aws_iam_saml_provider
\ aws_iam_server_certificate
\ aws_iam_user
\ aws_iam_user_login_profile
\ aws_iam_user_policy
\ aws_iam_user_policy_attachment
\ aws_iam_user_ssh_key
\ 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_alias
\ aws_lambda_event_source_mapping
\ aws_lambda_function
\ aws_lambda_permission
\ aws_launch_configuration
\ aws_lb_cookie_stickiness_policy
\ aws_lb_ssl_negotiation_policy
\ aws_lightsail_domain
\ aws_lightsail_instance
\ aws_lightsail_key_pair
\ aws_lightsail_static_ip
\ aws_lightsail_static_ip_attachment
\ aws_load_balancer_backend_server_policy
\ aws_load_balancer_listener_policy
\ aws_load_balancer_policy
\ aws_main_route_table_association
\ aws_nat_gateway
\ aws_network_acl
\ aws_network_acl_rule
\ aws_network_interface
\ aws_opsworks_application
\ aws_opsworks_custom_layer
\ aws_opsworks_ganglia_layer
\ aws_opsworks_haproxy_layer
\ aws_opsworks_instance
\ aws_opsworks_java_app_layer
\ aws_opsworks_memcached_layer
\ aws_opsworks_mysql_layer
\ aws_opsworks_nodejs_app_layer
\ aws_opsworks_permission
\ aws_opsworks_php_app_layer
\ aws_opsworks_rails_app_layer
\ aws_opsworks_rds_db_instance
\ aws_opsworks_stack
\ aws_opsworks_static_web_layer
\ aws_opsworks_user_profile
\ aws_placement_group
\ aws_proxy_protocol_policy
\ aws_rds_cluster
\ aws_rds_cluster_instance
\ aws_rds_cluster_parameter_group
\ aws_redshift_cluster
\ aws_redshift_parameter_group
\ aws_redshift_security_group
\ aws_redshift_subnet_group
\ aws_route
\ aws_route53_delegation_set
\ aws_route53_health_check
\ aws_route53_record
\ aws_route53_zone
\ aws_route53_zone_association
\ aws_route_table
\ aws_route_table_association
\ aws_s3_bucket
\ aws_s3_bucket_notification
\ aws_s3_bucket_object
\ aws_s3_bucket_policy
\ aws_security_group
\ aws_security_group_rule
\ aws_ses_active_receipt_rule_set
\ aws_ses_configuration_set
\ aws_ses_domain_identity
\ aws_ses_event_destination
\ aws_ses_receipt_filter
\ aws_ses_receipt_rule
\ aws_ses_receipt_rule_set
\ aws_sfn_activity
\ aws_sfn_state_machine
\ aws_simpledb_domain
\ aws_snapshot_create_volume_permission
\ aws_sns_topic
\ aws_sns_topic_policy
\ aws_sns_topic_subscription
\ aws_spot_datafeed_subscription
\ aws_spot_fleet_request
\ aws_spot_instance_request
\ aws_sqs_queue
\ aws_sqs_queue_policy
\ aws_ssm_activation
\ aws_ssm_association
\ aws_ssm_document
\ aws_subnet
\ aws_volume_attachment
\ aws_vpc
\ aws_vpc_dhcp_options
\ aws_vpc_dhcp_options_association
\ aws_vpc_endpoint
\ aws_vpc_endpoint_route_table_association
\ aws_vpc_peering_connection
\ aws_vpc_peering_connection_accepter
\ 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_sql_injection_match_set
\ aws_waf_web_acl
\ aws_waf_xss_match_set
\ azure_affinity_group
\ azure_data_disk
\ azure_dns_server
\ azure_hosted_service
\ azure_instance
\ azure_local_network_connection
\ azure_security_group
\ azure_security_group_rule
\ azure_sql_database_server
\ azure_sql_database_server_firewall_rule
\ azure_sql_database_service
\ azure_storage_blob
\ azure_storage_container
\ azure_storage_queue
\ azure_storage_service
\ azure_virtual_network
\ azurerm_availability_set
\ azurerm_cdn_endpoint
\ azurerm_cdn_profile
\ azurerm_container_registry
\ azurerm_container_service
\ 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_eventhub
\ azurerm_eventhub_authorization_rule
\ azurerm_eventhub_consumer_group
\ azurerm_eventhub_namespace
\ azurerm_key_vault
\ azurerm_lb
\ azurerm_lb_backend_address_pool
\ azurerm_lb_nat_pool
\ azurerm_lb_nat_rule
\ azurerm_lb_probe
\ azurerm_lb_rule
\ azurerm_local_network_gateway
\ azurerm_managed_disk
\ azurerm_network_interface
\ azurerm_network_security_group
\ azurerm_network_security_rule
\ azurerm_public_ip
\ azurerm_redis_cache
\ azurerm_resource_group
\ azurerm_route
\ azurerm_route_table
\ azurerm_search_service
\ azurerm_servicebus_namespace
\ azurerm_servicebus_subscription
\ azurerm_servicebus_topic
\ azurerm_sql_database
\ azurerm_sql_firewall_rule
\ azurerm_sql_server
\ azurerm_storage_account
\ azurerm_storage_blob
\ azurerm_storage_container
\ azurerm_storage_queue
\ azurerm_storage_share
\ azurerm_storage_table
\ azurerm_subnet
\ azurerm_template_deployment
\ azurerm_traffic_manager_endpoint
\ azurerm_traffic_manager_profile
\ azurerm_virtual_machine
\ azurerm_virtual_machine_extension
\ azurerm_virtual_machine_scale_set
\ azurerm_virtual_network
\ azurerm_virtual_network_peering
\ bitbucket_default_reviewers
\ bitbucket_hook
\ 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_group
\ clc_load_balancer
\ clc_load_balancer_pool
\ clc_public_ip
\ clc_server
\ 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
\ consul_agent_service
\ consul_catalog_entry
\ consul_key_prefix
\ consul_keys
\ consul_node
\ consul_prepared_query
\ consul_service
\ datadog_downtime
\ 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_issue_label
\ github_membership
\ github_organization_webhook
\ github_repository
\ github_repository_collaborator
\ github_repository_webhook
\ github_team
\ github_team_membership
\ github_team_repository
\ google_compute_address
\ google_compute_autoscaler
\ 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_project
\ google_project_iam_policy
\ google_project_services
\ google_pubsub_subscription
\ google_pubsub_topic
\ google_service_account
\ google_sql_database
\ google_sql_database_instance
\ google_sql_user
\ google_storage_bucket
\ google_storage_bucket_acl
\ google_storage_bucket_object
\ google_storage_object_acl
\ heroku_addon
\ heroku_app
\ heroku_cert
\ heroku_domain
\ heroku_drain
\ icinga2_checkcommand
\ icinga2_host
\ icinga2_hostgroup
\ icinga2_service
\ ignition_config
\ ignition_disk
\ ignition_file
\ ignition_filesystem
\ ignition_group
\ ignition_networkd_unit
\ ignition_raid
\ ignition_systemd_unit
\ ignition_user
\ influxdb_continuous_query
\ influxdb_database
\ influxdb_user
\ kubernetes_config_map
\ kubernetes_namespace
\ kubernetes_persistent_volume
\ kubernetes_persistent_volume_claim
\ kubernetes_secret
\ librato_alert
\ librato_service
\ librato_space
\ librato_space_chart
\ logentries_log
\ logentries_logset
\ mailgun_domain
\ mysql_database
\ mysql_grant
\ mysql_user
\ newrelic_alert_channel
\ newrelic_alert_condition
\ newrelic_alert_policy
\ newrelic_alert_policy_channel
\ nomad_job
\ null_resource
\ openstack_blockstorage_volume_attach_v2
\ openstack_blockstorage_volume_v1
\ openstack_blockstorage_volume_v2
\ openstack_compute_floatingip_associate_v2
\ openstack_compute_floatingip_v2
\ openstack_compute_instance_v2
\ openstack_compute_keypair_v2
\ openstack_compute_secgroup_v2
\ openstack_compute_servergroup_v2
\ openstack_compute_volume_attach_v2
\ openstack_fw_firewall_v1
\ openstack_fw_policy_v1
\ openstack_fw_rule_v1
\ openstack_images_image_v2
\ openstack_lb_listener_v2
\ openstack_lb_loadbalancer_v2
\ openstack_lb_member_v1
\ openstack_lb_member_v2
\ openstack_lb_monitor_v1
\ openstack_lb_monitor_v2
\ openstack_lb_pool_v1
\ openstack_lb_pool_v2
\ openstack_lb_vip_v1
\ openstack_networking_floatingip_v2
\ openstack_networking_network_v2
\ openstack_networking_port_v2
\ openstack_networking_router_interface_v2
\ openstack_networking_router_route_v2
\ openstack_networking_router_v2
\ openstack_networking_secgroup_rule_v2
\ openstack_networking_secgroup_v2
\ openstack_networking_subnet_v2
\ openstack_objectstorage_container_v1
\ opsgenie_team
\ opsgenie_user
\ packet_device
\ packet_project
\ packet_ssh_key
\ packet_volume
\ pagerduty_addon
\ pagerduty_escalation_policy
\ pagerduty_schedule
\ pagerduty_service
\ pagerduty_service_integration
\ pagerduty_team
\ pagerduty_user
\ postgresql_database
\ postgresql_extension
\ postgresql_role
\ postgresql_schema
\ powerdns_record
\ profitbricks_datacenter
\ profitbricks_firewall
\ profitbricks_ipblock
\ 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_certificate
\ rancher_environment
\ rancher_host
\ rancher_registration_token
\ rancher_registry
\ rancher_registry_credential
\ rancher_stack
\ random_id
\ random_pet
\ random_shuffle
\ rundeck_job
\ rundeck_private_key
\ rundeck_project
\ rundeck_public_key
\ scaleway_ip
\ scaleway_security_group
\ scaleway_security_group_rule
\ scaleway_server
\ scaleway_volume
\ scaleway_volume_attachment
\ softlayer_ssh_key
\ softlayer_virtual_guest
\ spotinst_aws_group
\ spotinst_healthcheck
\ spotinst_subscription
\ statuscake_test
\ tls_cert_request
\ tls_locally_signed_cert
\ tls_private_key
\ tls_self_signed_cert
\ triton_fabric
\ triton_firewall_rule
\ triton_key
\ triton_machine
\ triton_vlan
\ ultradns_dirpool
\ ultradns_probe_http
\ ultradns_probe_ping
\ ultradns_record
\ ultradns_tcpool
\ vcd_dnat
\ vcd_firewall_rules
\ vcd_network
\ vcd_snat
\ vcd_vapp
\ vsphere_file
\ vsphere_folder
\ vsphere_virtual_disk
\ vsphere_virtual_machine
""" end resources
syn keyword terraTodo contained TODO FIXME XXX BUG
syn cluster terraCommentGroup contains=terraTodo
syn region terraComment start="/\*" end="\*/" contains=@terraCommentGroup,@Spell
syn region terraComment start="#" end="$" contains=@terraCommentGroup,@Spell
syn region terraComment start="//" end="$" contains=@terraCommentGroup,@Spell
syn match terraResource /\<resource\>/ nextgroup=terraResourceTypeStr skipwhite
syn region terraResourceTypeStr start=/"/ end=/"/ contains=terraResourceTypeBI
\ nextgroup=terraResourceName skipwhite
syn region terraResourceName start=/"/ end=/"/
\ nextgroup=terraResourceBlock skipwhite
syn match terraData /\<data\>/ nextgroup=terraDataTypeStr skipwhite
syn region terraDataTypeStr start=/"/ end=/"/ contains=terraDataTypeBI
\ nextgroup=terraDataName skipwhite
syn region terraDataName start=/"/ end=/"/
\ nextgroup=terraDataBlock skipwhite
""" provider
syn match terraProvider /\<provider\>/ nextgroup=terraProviderName skipwhite
syn region terraProviderName start=/"/ end=/"/ nextgroup=terraProviderBlock skipwhite
""" provisioner
syn match terraProvisioner /\<provisioner\>/ nextgroup=terraProvisionerName skipwhite
syn region terraProvisionerName start=/"/ end=/"/ nextgroup=terraProvisionerBlock skipwhite
""" module
syn match terraModule /\<module\>/ nextgroup=terraModuleName skipwhite
syn region terraModuleName start=/"/ end=/"/ nextgroup=terraModuleBlock skipwhite
""" misc.
syn match terraValueDec "\<[0-9]\+\([kKmMgG]b\?\)\?\>"
syn match terraValueHexaDec "\<0x[0-9a-f]\+\([kKmMgG]b\?\)\?\>"
syn match terraBraces "[{}\[\]]"
""" skip \" in strings.
""" we may also want to pass \\" into a function to escape quotes.
syn region terraValueString start=/"/ skip=/\\\+"/ end=/"/ contains=terraStringInterp
syn region terraStringInterp matchgroup=terraBrackets start=/\${/ end=/}/ contains=terraValueFunction contained
"" TODO match keywords here, not a-z+
syn region terraValueFunction matchgroup=terraBrackets start=/[0-9a-z]\+(/ end=/)/ contains=terraValueString,terraValueFunction contained
hi def link terraComment Comment
hi def link terraTodo Todo
hi def link terraBrackets Operator
hi def link terraProvider Structure
hi def link terraBraces Delimiter
hi def link terraProviderName String
hi def link terraResource Structure
hi def link terraResourceName String
hi def link terraResourceTypeBI Tag
hi def link terraResourceTypeStr String
hi def link terraData Structure
hi def link terraDataName String
hi def link terraDataTypeBI Tag
hi def link terraDataTypeStr String
hi def link terraSection Structure
hi def link terraStringInterp Identifier
hi def link terraValueBool Boolean
hi def link terraValueDec Number
hi def link terraValueHexaDec Number
hi def link terraValueString String
hi def link terraProvisioner Structure
hi def link terraProvisionerName String
hi def link terraModule Structure
hi def link terraModuleName String
hi def link terraValueFunction Identifier
let b:current_syntax = "terraform"

View file

@ -0,0 +1,49 @@
#!/bin/bash
VERSION=$1
function usage {
echo -e "
USAGE EXAMPLES:
./$(basename $0) 0.8.7
./$(basename $0) 0.9.2
"
}
if [ $# -ne 1 ]; then
usage
exit 1
fi
EXISTING_TF_VERSION=$(terraform version | head -n1 | sed -e 's/Terraform//gI' -e 's/v//gI' -e 's/[[:space:]]//g')
if [ "${EXISTING_TF_VERSION}" != "${VERSION}" ]; then
echo "-) You are trying to update this script for terraform ${VERSION} while you have"
echo " terraform ${EXISTING_TF_VERSION} installed at $(which terraform)."
echo " Please update your local terraform before using this script."
exit 1
fi
echo "+) Acquiring terraform-${VERSION}"
wget https://github.com/hashicorp/terraform/archive/v${VERSION}.tar.gz
echo "+) Extracting terraform-${VERSION}.tar.gz"
tar zxf v${VERSION}.tar.gz
echo "+) Running update_commands.rb"
./update_commands.rb
echo "+) Running update_data_sources.rb"
./update_data_sources.rb terraform-${VERSION}/
echo "+) Running update_syntax.rb"
./update_syntax.rb terraform-${VERSION}/
echo "+) Updating the badge in the README.md"
sed -i "/img.shields.io/c\[\![](https://img.shields.io/badge/Supports%20Terraform%20Version-%3E%3D${VERSION}-blue.svg)](https://github.com/hashicorp/terraform/blob/v${VERSION}/CHANGELOG.md)" README.md
echo "+) Cleaning up after ourselves"
rm -f v${VERSION}.tar.gz
rm -rf terraform-${VERSION}
git status

View file

@ -0,0 +1,36 @@
#!/usr/bin/env ruby
# Use this script to update the commands auto-completed in plugin/terraform.vim.
require 'open3'
command_re = /^\s\s\s\s(\S+)/
plugin_file = 'plugin/terraform.vim'
# Create the list of commands.
stdout, stderr, _status = Open3.capture3('terraform list-commands')
output = if stderr == ''
stdout.split("\n")
else
stderr.split("\n")
end
commands = output.collect do |l|
match = command_re.match(l)
" \\ \"#{match[1]}\"" if match
end.reject(&:nil?).join(",\n")
# Read in the existing plugin file.
plugin = File.open(plugin_file, 'r').readlines
# Replace the terraResourceTypeBI lines with our new list.
first = plugin.index { |l| /^ return join\(\[/.match(l) } + 1
last = plugin.index { |l| /^ \\ \], "\\n"\)/.match(l) }
plugin.slice!(first, last - first)
commands.split("\n").reverse_each do |r|
plugin.insert(first, r)
end
# Write the plugin file back out.
File.open(plugin_file, 'w') do |f|
f.puts plugin
end

View file

@ -0,0 +1,36 @@
#!/usr/bin/env ruby
# Use this script to update the resources recognized in syntax/terraform.vim.
# You'll need a current checkout of the Terraform source.
resource_declaration = /"(.*)":.*dataSource.*\(\),$/
syntax_file = 'syntax/terraform.vim'
# Specify the location of the Terraform source as the only argument to this
# script.
raise 'Please specify the location of the Terraform source.' if ARGV.empty?
# Create the list of resources.
provider_files = Dir.glob("#{ARGV[0]}/builtin/providers/*/*provider.go")
resources = provider_files.collect do |f|
File.open(f, 'r').readlines.collect do |l|
match = resource_declaration.match(l)
" \\ #{match[1]}\n" if match
end.reject(&:nil?)
end.flatten.sort.uniq
# Read in the existing syntax file.
syntax = File.open(syntax_file, 'r').readlines
# Replace the terraResourceTypeBI lines with our new list.
first = syntax.index { |l| /^syn keyword terraDataTypeBI/.match(l) } + 1
last = syntax.index { |l| /^""" end data sources/.match(l) }
syntax.slice!(first, last - first)
resources.reverse_each do |r|
syntax.insert(first, r)
end
# Write the syntax file back out.
File.open(syntax_file, 'w') do |f|
f.puts syntax
end

View file

@ -0,0 +1,36 @@
#!/usr/bin/env ruby
# Use this script to update the resources recognized in syntax/terraform.vim.
# You'll need a current checkout of the Terraform source.
resource_declaration = /"(.*)":.*resource.*\(\),$/
syntax_file = 'syntax/terraform.vim'
# Specify the location of the Terraform source as the only argument to this
# script.
raise 'Please specify the location of the Terraform source.' if ARGV.empty?
# Create the list of resources.
provider_files = Dir.glob("#{ARGV[0]}/builtin/providers/*/*provider.go")
resources = provider_files.collect do |f|
File.open(f, 'r').readlines.collect do |l|
match = resource_declaration.match(l)
" \\ #{match[1]}\n" if match
end.reject(&:nil?)
end.flatten.sort
# Read in the existing syntax file.
syntax = File.open(syntax_file, 'r').readlines
# Replace the terraResourceTypeBI lines with our new list.
first = syntax.index { |l| /^syn keyword terraResourceTypeBI/.match(l) } + 1
last = syntax.index { |l| /^""" end resources/.match(l) }
syntax.slice!(first, last - first)
resources.reverse_each do |r|
syntax.insert(first, r)
end
# Write the syntax file back out.
File.open(syntax_file, 'w') do |f|
f.puts syntax
end

7
.vimrc
View file

@ -274,3 +274,10 @@ let g:typescript_compiler_binary = 'tsc'
let g:typescript_compiler_options = ''
au FileType typescript :set makeprg=tsc
" ======================
" terraform
" ======================
let g:terraform_align=1
au FileType terraform setlocal commentstring=#%s