Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Terraform bumps and bugfix #557

Merged
merged 3 commits into from
Mar 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions helper/src/components/deployTab.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ export default function DeployTab({ defaults, updateFn, tabValues, invalidArray,
}

const params2tf = p => Object.keys(p).map(k => {
return ` ${k} = ${k.toLowerCase().endsWith('principalid') ? '{value=data.azurerm_client_config.current.client_id}' : `{value=var.${k}}`}\n`
return ` ${k} = ${k.toLowerCase().endsWith('principalid') ? '{value=data.azurerm_client_config.current.object_id}' : `{value=var.${k}}`}\n`
}).join('')

const params2TfVar = p => Object.keys(p).filter(p => p !== 'adminPrincipalId' &&
Expand Down Expand Up @@ -283,11 +283,11 @@ export default function DeployTab({ defaults, updateFn, tabValues, invalidArray,
const deployTfProviders =
`#providers.tf\n\n` +
`terraform {\n` +
` required_version = ">=1.1.9"\n` +
` required_version = ">=1.3.2"\n` +
` required_providers {\n` +
` azurerm = {\n` +
` source = "hashicorp/azurerm"\n` +
` version = "~>3.6"\n` +
` version = "~>3.48"\n` +
` }\n` +
` }\n` +
`}\n\n` +
Expand All @@ -312,14 +312,17 @@ export default function DeployTab({ defaults, updateFn, tabValues, invalidArray,
` name = "AKS-C"\n` +
` resource_group_name = azurerm_resource_group.rg.name\n` +
` deployment_mode = "Incremental"\n` +
` template_content = data.http.aksc_release.body\n` +
` template_content = data.http.aksc_release.response_body\n` +
` parameters_content = jsonencode({\n` +
params2tf(finalParams) +
` })\n` +
`}`

const deployTfVar = `#variables.tf\n\nvariable resourceGroupName {\n type=string\n default="${deploy.rg}"\n}\nvariable location {\n type=string\n default="${deploy.location}"\n}` + params2TfVar(finalParams)
const deployTfOutput = `#outputs.tf\n\noutput aksClusterName {\n value = jsondecode(azurerm_resource_group_template_deployment.aksc_deploy.output_content).aksClusterName.value\n description = "The name of the AKS cluster."\n}`
const deployTfOutput = `#outputs.tf\n\n` +
`output aksClusterName {\n value = jsondecode(azurerm_resource_group_template_deployment.aksc_deploy.output_content).aksClusterName.value\n description = "The name of the AKS cluster."\n}\n` +
`output userClientId {\n value = data.azurerm_client_config.current.client_id\n description = "Current User ClientId"\n}\n` +
`output userObjectId {\n value = data.azurerm_client_config.current.object_id\n description = "Current User ObjectId"\n}`

const param_file = JSON.stringify(params2file(finalParams), null, 2).replaceAll('\\\\\\', '').replaceAll('\\\\\\', '')

Expand Down