Skip to content

Instantly share code, notes, and snippets.

@hfm
Created September 21, 2018 20:24
Show Gist options
  • Save hfm/97e431f9bfe9eb14bd6e3674fe257ea6 to your computer and use it in GitHub Desktop.
Save hfm/97e431f9bfe9eb14bd6e3674fe257ea6 to your computer and use it in GitHub Desktop.
$ TF_LOG=DEBUG terraform apply
2018/09/22 05:23:55 [INFO] Terraform version: 0.11.8
2018/09/22 05:23:55 [INFO] Go runtime version: go1.10.3
2018/09/22 05:23:55 [INFO] CLI args: []string{"/usr/local/Cellar/terraform/0.11.8/bin/terraform", "apply"}
2018/09/22 05:23:55 [DEBUG] Attempting to open CLI config file: /Users/hfm/.terraformrc
2018/09/22 05:23:55 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2018/09/22 05:23:55 [INFO] CLI command args: []string{"apply"}
2018/09/22 05:23:55 [INFO] command: empty terraform config, returning nil
2018/09/22 05:23:55 [DEBUG] command: no data state file found for backend config
2018/09/22 05:23:55 [DEBUG] New state was assigned lineage "dbc86cfe-938f-545d-334d-b5c1aaf0cba1"
2018/09/22 05:23:55 [INFO] command: backend initialized: <nil>
2018/09/22 05:23:55 [DEBUG] checking for provider in "."
2018/09/22 05:23:55 [DEBUG] checking for provider in "/usr/local/Cellar/terraform/0.11.8/bin"
2018/09/22 05:23:55 [DEBUG] checking for provider in ".terraform/plugins/darwin_amd64"
2018/09/22 05:23:55 [DEBUG] found provider "terraform-provider-mysql_v1.1.0_x4"
2018/09/22 05:23:55 [DEBUG] found valid plugin: "mysql", "1.1.0", "/Users/hfm/src/github.com/hfm/sample-tf-mysql-provider/.terraform/plugins/darwin_amd64/terraform-provider-mysql_v1.1.0_x4"
2018/09/22 05:23:55 [DEBUG] checking for provisioner in "."
2018/09/22 05:23:55 [DEBUG] checking for provisioner in "/usr/local/Cellar/terraform/0.11.8/bin"
2018/09/22 05:23:55 [DEBUG] checking for provisioner in ".terraform/plugins/darwin_amd64"
2018/09/22 05:23:55 [INFO] command: backend <nil> is not enhanced, wrapping in local
2018/09/22 05:23:55 [INFO] backend/local: starting Apply operation
2018/09/22 05:23:55 [INFO] terraform: building graph: GraphTypeInput
2018/09/22 05:23:55 [DEBUG] Attaching resource state to "mysql_user.hfm": &terraform.ResourceState{Type:"mysql_user", Dependencies:[]string{}, Primary:(*terraform.InstanceState)(0xc4200c0e60), Deposed:[]*terraform.InstanceState{}, Provider:"provider.mysql", mu:sync.Mutex{state:0, sema:0x0}}
2018/09/22 05:23:55 [DEBUG] Attaching resource state to "mysql_grant.hfm": &terraform.ResourceState{Type:"mysql_grant", Dependencies:[]string{}, Primary:(*terraform.InstanceState)(0xc4200c0e10), Deposed:[]*terraform.InstanceState{}, Provider:"provider.mysql", mu:sync.Mutex{state:0, sema:0x0}}
2018/09/22 05:23:55 [DEBUG] resource mysql_user.hfm using provider provider.mysql
2018/09/22 05:23:55 [DEBUG] resource mysql_grant.hfm using provider provider.mysql
2018/09/22 05:23:55 [DEBUG] ReferenceTransformer: "mysql_grant.hfm" references: []
2018/09/22 05:23:55 [DEBUG] ReferenceTransformer: "provider.mysql" references: []
2018/09/22 05:23:55 [DEBUG] ReferenceTransformer: "mysql_user.hfm" references: []
2018/09/22 05:23:55 [TRACE] Graph after step *terraform.ReferenceTransformer:
mysql_grant.hfm - *terraform.NodeAbstractResource
provider.mysql - *terraform.NodeApplyableProvider
mysql_user.hfm - *terraform.NodeAbstractResource
provider.mysql - *terraform.NodeApplyableProvider
provider.mysql - *terraform.NodeApplyableProvider
2018/09/22 05:23:55 [DEBUG] Starting graph walk: walkInput
2018-09-22T05:23:55.886+0900 [DEBUG] plugin: starting plugin: path=/Users/hfm/src/github.com/hfm/sample-tf-mysql-provider/.terraform/plugins/darwin_amd64/terraform-provider-mysql_v1.1.0_x4 args=[/Users/hfm/src/github.com/hfm/sample-tf-mysql-provider/.terraform/plugins/darwin_amd64/terraform-provider-mysql_v1.1.0_x4]
2018-09-22T05:23:55.891+0900 [DEBUG] plugin: waiting for RPC address: path=/Users/hfm/src/github.com/hfm/sample-tf-mysql-provider/.terraform/plugins/darwin_amd64/terraform-provider-mysql_v1.1.0_x4
2018-09-22T05:23:55.901+0900 [DEBUG] plugin.terraform-provider-mysql_v1.1.0_x4: 2018/09/22 05:23:55 [DEBUG] plugin: plugin address: unix /var/folders/f2/l82jqszs19v74zl_9h7jjx4m0000gn/T/plugin251468210
2018/09/22 05:23:55 [INFO] terraform: building graph: GraphTypeValidate
2018/09/22 05:23:55 [DEBUG] Attaching resource state to "mysql_user.hfm": &terraform.ResourceState{Type:"mysql_user", Dependencies:[]string{}, Primary:(*terraform.InstanceState)(0xc4200c0e60), Deposed:[]*terraform.InstanceState{}, Provider:"provider.mysql", mu:sync.Mutex{state:0, sema:0x0}}
2018/09/22 05:23:55 [DEBUG] Attaching resource state to "mysql_grant.hfm": &terraform.ResourceState{Type:"mysql_grant", Dependencies:[]string{}, Primary:(*terraform.InstanceState)(0xc4200c0e10), Deposed:[]*terraform.InstanceState{}, Provider:"provider.mysql", mu:sync.Mutex{state:0, sema:0x0}}
2018/09/22 05:23:55 [TRACE] Graph after step *terraform.AttachStateTransformer:
mysql_grant.hfm - *terraform.NodeValidatableResource
mysql_user.hfm - *terraform.NodeValidatableResource
2018/09/22 05:23:55 [TRACE] Graph after step *terraform.RootVariableTransformer:
mysql_grant.hfm - *terraform.NodeValidatableResource
mysql_user.hfm - *terraform.NodeValidatableResource
2018/09/22 05:23:55 [TRACE] ProviderConfigTransformer: Starting for path: []
2018/09/22 05:23:55 [TRACE] Attach provider request: []string{} mysql
2018/09/22 05:23:55 [DEBUG] resource mysql_grant.hfm using provider provider.mysql
2018/09/22 05:23:55 [DEBUG] resource mysql_user.hfm using provider provider.mysql
2018/09/22 05:23:55 [DEBUG] ReferenceTransformer: "mysql_user.hfm" references: []
2018/09/22 05:23:55 [DEBUG] ReferenceTransformer: "mysql_grant.hfm" references: []
2018/09/22 05:23:55 [DEBUG] ReferenceTransformer: "provider.mysql" references: []
2018/09/22 05:23:55 [DEBUG] Starting graph walk: walkValidate
2018/09/22 05:23:55 [DEBUG] Attaching resource state to "mysql_grant.hfm": &terraform.ResourceState{Type:"mysql_grant", Dependencies:[]string{}, Primary:(*terraform.InstanceState)(0xc4200c0e10), Deposed:[]*terraform.InstanceState{}, Provider:"provider.mysql", mu:sync.Mutex{state:0, sema:0x0}}
2018/09/22 05:23:55 [DEBUG] Attaching resource state to "mysql_user.hfm": &terraform.ResourceState{Type:"mysql_user", Dependencies:[]string{}, Primary:(*terraform.InstanceState)(0xc4200c0e60), Deposed:[]*terraform.InstanceState{}, Provider:"provider.mysql", mu:sync.Mutex{state:0, sema:0x0}}
2018/09/22 05:23:55 [DEBUG] ReferenceTransformer: "mysql_grant.hfm" references: []
2018/09/22 05:23:55 [DEBUG] ReferenceTransformer: "mysql_user.hfm" references: []
2018/09/22 05:23:55 [INFO] backend/local: apply calling Refresh
2018/09/22 05:23:55 [INFO] terraform: building graph: GraphTypeRefresh
2018/09/22 05:23:55 [DEBUG] Attaching resource state to "mysql_user.hfm": &terraform.ResourceState{Type:"mysql_user", Dependencies:[]string{}, Primary:(*terraform.InstanceState)(0xc4203a8af0), Deposed:[]*terraform.InstanceState{}, Provider:"provider.mysql", mu:sync.Mutex{state:0, sema:0x0}}
2018/09/22 05:23:55 [DEBUG] Attaching resource state to "mysql_grant.hfm": &terraform.ResourceState{Type:"mysql_grant", Dependencies:[]string{}, Primary:(*terraform.InstanceState)(0xc4203a8aa0), Deposed:[]*terraform.InstanceState{}, Provider:"provider.mysql", mu:sync.Mutex{state:0, sema:0x0}}
2018/09/22 05:23:55 [DEBUG] resource mysql_user.hfm using provider provider.mysql
2018/09/22 05:23:55 [DEBUG] resource mysql_grant.hfm using provider provider.mysql
2018/09/22 05:23:55 [DEBUG] ReferenceTransformer: "mysql_user.hfm" references: []
2018/09/22 05:23:55 [DEBUG] ReferenceTransformer: "mysql_grant.hfm" references: []
2018/09/22 05:23:55 [DEBUG] ReferenceTransformer: "provider.mysql" references: []
2018/09/22 05:23:55 [DEBUG] Attaching resource state to "mysql_user.hfm": &terraform.ResourceState{Type:"mysql_user", Dependencies:[]string{}, Primary:(*terraform.InstanceState)(0xc4203a8af0), Deposed:[]*terraform.InstanceState{}, Provider:"provider.mysql", mu:sync.Mutex{state:0, sema:0x0}}
2018/09/22 05:23:55 [TRACE] Graph after step *terraform.AttachStateTransformer:
mysql_user.hfm - *terraform.NodeRefreshableManagedResourceInstance
2018/09/22 05:23:55 [DEBUG] ReferenceTransformer: "mysql_user.hfm" references: []
2018/09/22 05:23:55 [DEBUG] Attaching resource state to "mysql_grant.hfm": &terraform.ResourceState{Type:"mysql_grant", Dependencies:[]string{}, Primary:(*terraform.InstanceState)(0xc4203a8aa0), Deposed:[]*terraform.InstanceState{}, Provider:"provider.mysql", mu:sync.Mutex{state:0, sema:0x0}}
mysql_user.hfm: Refreshing state... (ID: hfm@%)
mysql_grant.hfm: Refreshing state... (ID: hfm@%:sample)
2018-09-22T05:23:55.924+0900 [DEBUG] plugin.terraform-provider-mysql_v1.1.0_x4: 2018/09/22 05:23:55 Executing statement: SHOW GRANTS FOR 'hfm'@'%'
2018-09-22T05:23:55.924+0900 [DEBUG] plugin.terraform-provider-mysql_v1.1.0_x4: 2018/09/22 05:23:55 Executing statement: SELECT USER FROM mysql.user WHERE USER='hfm'
2018/09/22 05:23:55 [INFO] backend/local: apply calling Plan
2018/09/22 05:23:55 [INFO] terraform: building graph: GraphTypePlan
2018/09/22 05:23:55 [DEBUG] Resource state not found for "mysql_grant.hfm": mysql_grant.hfm
2018/09/22 05:23:55 [DEBUG] Resource state not found for "mysql_user.hfm": mysql_user.hfm
2018/09/22 05:23:55 [TRACE] Graph after step *terraform.AttachStateTransformer:
mysql_grant.hfm - *terraform.NodePlannableResource
mysql_user.hfm - *terraform.NodePlannableResource
2018/09/22 05:23:55 [DEBUG] resource mysql_user.hfm using provider provider.mysql
2018/09/22 05:23:55 [DEBUG] resource mysql_grant.hfm using provider provider.mysql
2018/09/22 05:23:55 [DEBUG] ReferenceTransformer: "mysql_user.hfm" references: []
2018/09/22 05:23:55 [DEBUG] ReferenceTransformer: "mysql_grant.hfm" references: []
2018/09/22 05:23:55 [DEBUG] ReferenceTransformer: "provider.mysql" references: []
2018/09/22 05:23:55 [DEBUG] Starting graph walk: walkPlan
2018/09/22 05:23:55 [DEBUG] Resource state not found for "mysql_user.hfm": mysql_user.hfm
2018/09/22 05:23:55 [DEBUG] ReferenceTransformer: "mysql_user.hfm" references: []
An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
+ create
Terraform will perform the following actions:
+ mysql_grant.hfm
2018/09/22 05:23:55 [DEBUG] command: asking for input: "Do you want to perform these actions?"
id: <computed>
database: "sample"
grant: "false"
host: "%"
privileges.#: "1"
privileges.2914988887: "ALL"
user: "hfm"
+ mysql_user.hfm
id: <computed>
host: "%"
plaintext_password: <sensitive>
user: "hfm"
Plan: 2 to add, 0 to change, 0 to destroy.
Do you want to perform these actions?
Terraform will perform the actions described above.
Only 'yes' will be accepted to approve.
Enter a value: yes
2018/09/22 05:23:57 [INFO] terraform: building graph: GraphTypeApply
2018/09/22 05:23:57 [DEBUG] Resource state not found for "mysql_grant.hfm": mysql_grant.hfm
2018/09/22 05:23:57 [DEBUG] Resource state not found for "mysql_user.hfm": mysql_user.hfm
2018/09/22 05:23:57 [TRACE] Graph after step *terraform.AttachStateTransformer:
mysql_grant.hfm - *terraform.NodeApplyableResource
mysql_user.hfm - *terraform.NodeApplyableResource
2018/09/22 05:23:57 [DEBUG] resource mysql_grant.hfm using provider provider.mysql
2018/09/22 05:23:57 [DEBUG] resource mysql_user.hfm using provider provider.mysql
2018/09/22 05:23:57 [DEBUG] ReferenceTransformer: "mysql_grant.hfm" references: []
2018/09/22 05:23:57 [DEBUG] ReferenceTransformer: "mysql_user.hfm" references: []
2018/09/22 05:23:57 [DEBUG] ReferenceTransformer: "provider.mysql" references: []
2018/09/22 05:23:57 [TRACE] Graph after step *terraform.ReferenceTransformer:
mysql_grant.hfm - *terraform.NodeApplyableResource
provider.mysql - *terraform.NodeApplyableProvider
mysql_user.hfm - *terraform.NodeApplyableResource
provider.mysql - *terraform.NodeApplyableProvider
provider.mysql - *terraform.NodeApplyableProvider
2018/09/22 05:23:57 [DEBUG] Starting graph walk: walkApply
mysql_user.hfm: Creating...
2018/09/22 05:23:57 [DEBUG] apply: mysql_grant.hfm: executing Apply
host: "" => "%"
plaintext_password: "<sensitive>" => "<sensitive>"
user: "" => "hfm"
mysql_grant.hfm: Creating...
database: "" => "sample"
grant: "" => "false"
host: "" => "%"
2018-09-22T05:23:57.245+0900 [DEBUG] plugin.terraform-provider-mysql_v1.1.0_x4: 2018/09/22 05:23:57 Executing statement: CREATE USER 'hfm'@'%' IDENTIFIED BY 'samplehfmpassword'
2018-09-22T05:23:57.245+0900 [DEBUG] plugin.terraform-provider-mysql_v1.1.0_x4: 2018/09/22 05:23:57 Executing statement: GRANT ALL on sample.* TO 'hfm'@'%'
privileges.#: "" => "1"
privileges.2914988887: "" => "ALL"
user: "" => "hfm"
2018/09/22 05:23:57 [ERROR] root: eval: *terraform.EvalApplyPost, err: 1 error(s) occurred:
* mysql_grant.hfm: Error 1133: Can't find any matching row in the user table
2018/09/22 05:23:57 [ERROR] root: eval: *terraform.EvalSequence, err: 1 error(s) occurred:
* mysql_grant.hfm: Error 1133: Can't find any matching row in the user table
2018/09/22 05:23:57 [TRACE] [walkApply] Exiting eval tree: mysql_grant.hfm
mysql_user.hfm: Creation complete after 0s (ID: hfm@%)
2018/09/22 05:23:57 [DEBUG] plugin: waiting for all plugin processes to complete...
Error: Error applying plan:
1 error(s) occurred:
* mysql_grant.hfm: 1 error(s) occurred:
* mysql_grant.hfm: Error 1133: Can't find any matching row in the user table
Terraform does not automatically rollback in the face of errors.
Instead, your Terraform state file has been partially updated with
any resources that successfully completed. Please address the error
above and apply again to incrementally change your infrastructure.
2018-09-22T05:23:57.271+0900 [DEBUG] plugin: plugin process exited: path=/Users/hfm/src/github.com/hfm/sample-tf-mysql-provider/.terraform/plugins/darwin_amd64/terraform-provider-mysql_v1.1.0_x4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment