sassoftware / viya4-iac-azure

This project contains Terraform configuration files to provision infrastructure components required to deploy SAS Viya platform products on Microsoft Azure Cloud.
Apache License 2.0
72 stars 88 forks source link

Docker execution fails with multiple "data.external.iac_tooling_version is empty tuple" erros #62

Closed cjguerrap closed 3 years ago

cjguerrap commented 3 years ago

ubuntu@ip-10-249-6-127:~/sas/viya4-iac-azure$ docker run --rm --env-file $HOME/sas/.azure_docker_creds.env -v $HOME/sas/viya4-iac-azure:/workspace viya4-iac-azure plan -var-file /workspace/terraform.tfvars -state /workspace/terraform.tfstate Refreshing Terraform state in-memory prior to plan... The refreshed state will be used to calculate this plan, but will not be persisted to local or remote state storage.

data.template_file.nfs-cloudconfig: Refreshing state... data.external.git_hash: Refreshing state... data.template_cloudinit_config.nfs: Refreshing state... data.azuread_service_principal.sp_client: Refreshing state... data.azurerm_subscription.current: Refreshing state...


Warning: Interpolation-only expressions are deprecated

on main.tf line 134, in module "vnet": 134: "${local.aks_subnet_name}" = ["Microsoft.Sql"],

Terraform 0.11 and earlier required all non-constant expressions to be provided via interpolation syntax, but this pattern is now deprecated. To silence this warning, remove the "${ sequence from the start and the }" sequence from the end of this expression, leaving just the inner expression.

Template interpolation syntax is still used to construct strings from expressions when the template includes multiple interpolation sequences or a mixture of literal strings and interpolations. This deprecation applies only to templates that consist entirely of a single interpolation sequence.

(and one more similar warning elsewhere)

Error: Invalid index

on main.tf line 396, in data "template_file" "sas_iac_buildinfo": 396: terraform-version = lookup(data.external.iac_tooling_version.0.result, "terraform_version") |---------------- | data.external.iac_tooling_version is empty tuple

The given key does not identify an element in this collection value.

Error: Invalid index

on main.tf line 397, in data "template_file" "sas_iac_buildinfo": 397: provider-selections = lookup(data.external.iac_tooling_version.0.result, "provider_selections") |---------------- | data.external.iac_tooling_version is empty tuple

The given key does not identify an element in this collection value.

Error: Invalid index

on main.tf line 398, in data "template_file" "sas_iac_buildinfo": 398: terraform-revision = lookup(data.external.iac_tooling_version.0.result, "terraform_revision") |---------------- | data.external.iac_tooling_version is empty tuple

The given key does not identify an element in this collection value.

Error: Invalid index

on main.tf line 399, in data "template_file" "sas_iac_buildinfo": 399: terraform-outdated = lookup(data.external.iac_tooling_version.0.result, "terraform_outdated") |---------------- | data.external.iac_tooling_version is empty tuple

The given key does not identify an element in this collection value.

thpang commented 3 years ago

@cjguerrap when you ran this did you have old tfstate files? If you could try this again when you are able to remove your tfstate files to verify. NOTE: If you still have infrastructure setup in Azure you can delete the top level resource group from within the UI and then safely remove the tfstate files.

cjguerrap commented 3 years ago

Thomas,

It fails with the same displayed error even after deleting the tfstate files. I am running this from inside an Azure VM with: CentOS Linux release 7.7.1908 (Core) Docker version 19.03.8, build afacb8b

From: Thomas S. Pangborn notifications@github.com Sent: Monday, November 30, 2020 9:20 AM To: sassoftware/viya4-iac-azure viya4-iac-azure@noreply.github.com Cc: Cesar Guerra Cesar.Guerra@sas.com; Mention mention@noreply.github.com Subject: Re: [sassoftware/viya4-iac-azure] Docker execution fails with multiple "data.external.iac_tooling_version is empty tuple" erros (#62)

EXTERNAL

@cjguerraphttps://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fcjguerrap&data=04%7C01%7Ccesar.guerra%40sas.com%7Cbe69ba0be7ac4df11fd008d8953b150e%7Cb1c14d5c362545b3a4309552373a0c2f%7C0%7C0%7C637423428288092722%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=Z6vnPPUAV8NzkM62%2BmpHnNO0KQmaBwiL2Bll%2FQpG12k%3D&reserved=0 when you ran this did you have old tfstate files? If you could try this again when you are able to remove your tfstate files to verify. NOTE: If you still have infrastructure setup in Azure you can delete the top level resource group from within the UI and then safely remove the tfstate files.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fsassoftware%2Fviya4-iac-azure%2Fissues%2F62%23issuecomment-735814082&data=04%7C01%7Ccesar.guerra%40sas.com%7Cbe69ba0be7ac4df11fd008d8953b150e%7Cb1c14d5c362545b3a4309552373a0c2f%7C0%7C0%7C637423428288102680%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=WmDxCxAWwtU0WD3diR3Wai3kd2pe1DLvMPE2FE4itO8%3D&reserved=0, or unsubscribehttps://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FARR6FPZ6Z4JM6KFSBCAPC5DSSOS2TANCNFSM4UGINPVQ&data=04%7C01%7Ccesar.guerra%40sas.com%7Cbe69ba0be7ac4df11fd008d8953b150e%7Cb1c14d5c362545b3a4309552373a0c2f%7C0%7C0%7C637423428288112634%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=0eAhZ%2FIJEa3b3mdL6PrvOe%2BnCyLvCuix%2FPIRG%2F%2F6XUs%3D&reserved=0.


Si vous préférez ne plus recevoir des messages commerciaux électroniques par SAS, veuillez-vous désabonner icihttp://www.sas.com/emailpreferences/optout.html Merci.

If you do not wish to receive commercial electronic messages from SAS in the future, please click herehttp://www.sas.com/emailpreferences/optout.html to unsubscribe. Thank you.

thpang commented 3 years ago

@cjguerrap and @erwangranger I found the issue.

Changes to the iac_tooling_version.sh file and logic in the data.external.iac_tooling_version were not in sync. I removed the guard around the creation of the data element as the script now successfully works with both docker / terraform.

I'll be creating a pr for this one and attaching this issue.

Testing fix this evening.