You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please fix the following mistakes in the code examples:
Fix/Update the code:
jsondecode should be removed from jsondecode(azapi_resource_action.ssh_public_key_gen.output).publicKey in main.tf and ssh.tf at Implement the Terraform code section (see Problem 1 below),
so that the resulting code would be: azapi_resource_action.ssh_public_key_gen.output.publicKey
add -raw parameter at Verify the results section
to generate proper kubeconfig without end of stream "EOF" characters,
so that the resulting code would be: echo "$(terraform output -raw kube_config)" > ./azurek8s (see Problem 2 below)
Problem 1
The description and the solution: https://stackoverflow.com/questions/78457405/azapi-resource-action-invalid-value-for-str-parameter-string-required
╷
│ Error: Invalid function argument
│
│ on main.tf line 41, in resource "azurerm_kubernetes_cluster" "k8s":
│ 41: key_data = jsondecode(azapi_resource_action.ssh_public_key_gen.output).publicKey
│ ├────────────────
│ │ while calling jsondecode(str)
│ │ azapi_resource_action.ssh_public_key_gen.output is object with 2 attributes
│
│ Invalid value for "str" parameter: string required.
╵
╷
│ Error: Invalid function argument
│
│ on ssh.tf line 24, in output "key_data":
│ 24: value = jsondecode(azapi_resource_action.ssh_public_key_gen.output).publicKey
│ ├────────────────
│ │ while calling jsondecode(str)
│ │ azapi_resource_action.ssh_public_key_gen.output is object with 2 attributes
│
│ Invalid value for "str" parameter: string required.
Problem 2
(there is a workaround in the main instruction; but it should not be done manually in fact; adding -raw parameter solves the problem)
If you see << EOT at the beginning and EOT at the end, remove these characters from the file. Otherwise, you may receive the following error message: error: error loading config file "./azurek8s": yaml: line 2: mapping values are not allowed in this context
Type of issue
Code doesn't work
Feedback
Please fix the following mistakes in the code examples:
Fix/Update the code:
jsondecode
should be removed fromjsondecode(azapi_resource_action.ssh_public_key_gen.output).publicKey
inmain.tf
andssh.tf
at Implement the Terraform code section (see Problem 1 below),so that the resulting code would be:
azapi_resource_action.ssh_public_key_gen.output.publicKey
-raw
parameter at Verify the results sectionto generate proper kubeconfig without end of stream "EOF" characters,
so that the resulting code would be:
echo "$(terraform output -raw kube_config)" > ./azurek8s
(see Problem 2 below)Problem 1
The description and the solution:
https://stackoverflow.com/questions/78457405/azapi-resource-action-invalid-value-for-str-parameter-string-required
╷
│ Error: Invalid function argument
│
│ on main.tf line 41, in resource "azurerm_kubernetes_cluster" "k8s":
│ 41: key_data = jsondecode(azapi_resource_action.ssh_public_key_gen.output).publicKey
│ ├────────────────
│ │ while calling jsondecode(str)
│ │ azapi_resource_action.ssh_public_key_gen.output is object with 2 attributes
│
│ Invalid value for "str" parameter: string required.
╵
╷
│ Error: Invalid function argument
│
│ on ssh.tf line 24, in output "key_data":
│ 24: value = jsondecode(azapi_resource_action.ssh_public_key_gen.output).publicKey
│ ├────────────────
│ │ while calling jsondecode(str)
│ │ azapi_resource_action.ssh_public_key_gen.output is object with 2 attributes
│
│ Invalid value for "str" parameter: string required.
Problem 2
(there is a workaround in the main instruction; but it should not be done manually in fact; adding
-raw
parameter solves the problem)Page URL
https://learn.microsoft.com/en-us/azure/aks/learn/quick-kubernetes-deploy-terraform?tabs=bash
Content source URL
https://github.com/MicrosoftDocs/azure-docs/blob/main/articles/aks/learn/quick-kubernetes-deploy-terraform.md
Author
@schaffererin
Document Id
93009f1b-a279-2a19-5c87-6352d8af10c8
Document Details
⚠ Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.
The text was updated successfully, but these errors were encountered: