Comments (20)
I'm having the same problem. I'm running the plan
action, however there's some unexpected additional command being run, as can be seen in the logs.
[command]C:\hostedtoolcache\windows\terraform\0.12.19\x64\terraform.exe version
Terraform v0.12.19
+ provider.azurerm v1.32.1
�[31mToo many command line arguments. Configuration path expected.�[0m�[0m
�[31mTerraform couldn't read the given file as a state or plan file.
The errors while attempting to read the file as each format are
shown below.
State read error: Error loading statefile: open d:\a\1\s\plan-binary-8d32fa13-73b6-4789-9e7e-541a0ef228ee.tfplan: The system cannot find the file specified.
Plan read error: open d:\a\1\s\plan-binary-8d32fa13-73b6-4789-9e7e-541a0ef228ee.tfplan: The system cannot find the file specified.�[0m�[0m
So... what is the extension doing, and why is it failing, and why is the failure not causing the task to fail?
from azure-pipelines-terraform.
Facing the same issue. Init and Validate work without any problems, Plan and Apply is unable to read remote state file.
Too many command line arguments. Configuration path expected.
Terraform couldn't read the given file as a state or plan file.
The errors while attempting to read the file as each format are
shown below.
State read error: Error loading statefile: open /home/vsts/work/1/s/plan-binary-db4ed225-a78a-4ca8-88bd-8ada715d9c2d.tfplan: no such file or directory
Plan read error: open /home/vsts/work/1/s/plan-binary-db4ed225-a78a-4ca8-88bd-8ada715d9c2d.tfplan: no such file or directory
Finishing: TerraformTaskV1
from azure-pipelines-terraform.
Hi folks,
Any news on this @Roshan-Kumar-Microsoft ? This seems to be happening with everyone. I have a very dummy pipeline and I'm also getting this error.
Thank you
from azure-pipelines-terraform.
@algattik Are you still blocked ? Can you please share your skype Id to [email protected] So we can debug it further.
from azure-pipelines-terraform.
The extension was not viable for me because of this outstanding issue (as well as microsoft/azure-pipelines-extensions#748 microsoft/azure-pipelines-extensions#725)
so I built a template that avoids all three and adds a facility for manual plan approval. https://github.com/algattik/terraform-azure-pipelines-starter
from azure-pipelines-terraform.
same issue here
from azure-pipelines-terraform.
Update
I noticed that the issue I am running into should be reported independently, so I opened a new issue: microsoft/azure-pipelines-extensions#820
Original comment
Same issue here, with a very basic pipeline that uses an Azure Storage Account for its backend (tfstate file). As a result, this plugin has no value to users who want to use the AzureRM "Storage Account" backend at this time.
I've captured the simplest example I could imagine in my azdevops-terraform-plugin-tinker github repository. I've copied the code below in this comment for you to review. Feel free to fork the repository and import this project into your Azure DevOps & Cloud!
DevOps Pipeline YAML
- To test, replace all hardcoded values with valid values for your Azure Cloud/DevOps environment.
- 'd88e0c85-dev-subscription'
- 'terraform-rg'
- 'terraform03'
- 'tfstate'
# Simple example pipeline that simply aims to run terraform plan!
pool:
vmImage: 'Ubuntu-18.04'
trigger: none
steps:
# Install Terraform
- task: TerraformInstaller@0
inputs:
terraformVersion: '0.12.24'
# Run 'terraform init'
- task: TerraformTaskV1@0
inputs:
provider: 'azurerm'
command: 'init'
workingDirectory: '.'
backendServiceArm: 'd88e0c85-dev-subscription'
backendAzureRmResourceGroupName: 'terraform-rg'
backendAzureRmStorageAccountName: 'terraform03'
backendAzureRmContainerName: 'tfstate'
backendAzureRmKey: 'azdevops-terraform-plugin-tinker.tfstate'
# Run 'terraform plan'
- task: TerraformTaskV1@0
inputs:
provider: 'azurerm'
command: 'plan'
workingDirectory: '.'
backendServiceArm: 'd88e0c85-dev-subscription'
backendAzureRmResourceGroupName: 'terraform-rg'
backendAzureRmStorageAccountName: 'terraform03'
backendAzureRmContainerName: 'tfstate'
backendAzureRmKey: 'azdevops-terraform-plugin-tinker.tfstate'
Terraform file.
- To test, replace all hardcoded values with valid values for your Azure Cloud/DevOps environment.
- "d88e0c85-6145-437a-99a3-64e8900098a7"
- "terraform03"
- "tfstate"
provider "azurerm" {
version = "~>2.0"
subscription_id = "d88e0c85-6145-437a-99a3-64e8900098a7"
features {}
}
terraform {
backend "azurerm" {
storage_account_name = "terraform03"
container_name = "tfstate"
key = "azdevops-terraform-plugin-tinker.tfstate"
}
}
from azure-pipelines-terraform.
getting the same error as described above. The init task doesn't print the error (too many arguments) despite accepting the same inputs. Not clear what this "too many arguments" are and why it can't read the state file (which seems to look for in the local disk, so why is it not accessible)?
from azure-pipelines-terraform.
Same issue for me:
from azure-pipelines-terraform.
Hi guys, we are having the same problems. Is anyone looking into this yet, please?
Regards.
from azure-pipelines-terraform.
getting the same error as described above.
terraform is trying to read the files(tfplan & tfstate) from my self-hosted agent as shown in the error... but my states files are the stores on the azure blob.. this error is coming when we try to update already provision resource
Need to check why terraform trying to access files from agent
from azure-pipelines-terraform.
me too. trying to create an AML workspace.
from azure-pipelines-terraform.
In my case the pipeline looks like this:
displayName: 'Terraform Plan'
inputs:
provider: 'azurerm'
command: 'plan'
workingDirectory: '$(System.DefaultWorkingDirectory)/'
commandOptions: -var mysql_connstr="$(mysql_connstr)"'
environmentServiceNameAzureRM: 'DeployAutomationServicePrincipal'
The error Too many command line arguments
comes from the missing quotes on the mysql_connstr
variable value.
The connection string looks like this:
Data Source=someDb.mysql.database.azure.com;Database=someDb;User Id=someUserId;Password=somePassword
When inserted into the yaml it makes Terraform think that there are more than one argument.
I had to make sure "$(mysql_connstr)"
is written instead of $(mysql_connstr)
.
from azure-pipelines-terraform.
@algattik Are you still blocked ? Can you please share your skype Id to [email protected] So we can debug it further.
Why is this still not fixed?
from azure-pipelines-terraform.
Hi, I am a part of Solidify AB, newly appointed maintainers of the terraform extension. I will take a look at this issue.
from azure-pipelines-terraform.
Facing this issue as well
from azure-pipelines-terraform.
Any update on this issue @mericstam ?
from azure-pipelines-terraform.
Bumped into this issue today aswell! Any workarounds available @mericstam ?
from azure-pipelines-terraform.
I am working on a V3 of the Terraform task where I have cleaned up the code some and split the functions to their respective command fixing some of these errors i.e the extra show command. We are also adding a 'custom' command option where you technically could use any command that terraform supports.
the workaround I found right now for plan command to use commandoptions and use -out=tfplan + any additional options and in the apply command use commandoptions: tfplan + any additional options
more info: https://www.terraform.io/cli/commands/plan#other-options
However reading the first comment from 2019, it has errors in it, commandoptions are not correct:
commandOptions: -out tfplan -var environment=${{ parameters.environment}} ${{ parameters.TerraformVariables }}
according to terraform manual. https://www.terraform.io/cli/commands/plan#input-variables-on-the-command-line
parameter out needs a = sign. ex. -out=filename, where filename is typically tfplan.
on linux and macOS agents you should use single quotes -var 'name=value'
on windows agents you should use double quotes -var "name=value"
This last part is untested just info from terraform docs. But worth testing out. probably need to escape the quotes in yaml pipeline, Not sure how Node will treat quotes..
from azure-pipelines-terraform.
I added a fix for the too many command line arguments in PR #39
from azure-pipelines-terraform.
Related Issues (20)
- Terraform Init is not compatible with Azure ARM Federated Identity service connection. HOT 6
- TerraformInstaller@1 fails on Azure pipelines with image ubuntu-latest HOT 14
- Can we Authenticate using Service principle and Certificate instead of service connection in terraform task HOT 1
- Terraform apply fails with clientCredentialsToken already expired. HOT 13
- How to enable task.debug? HOT 2
- link to Marketplace listing HOT 1
- TerraformInstaller@1 fails with ambiguous identifier HOT 4
- state command not working HOT 9
- Terraform init failure on Azure Devops Pipeline HOT 11
- Azure DevOps pipeline Terraform init fails when using service connection that is linked to an Azure AD app registration that is using workload identity federation instead of client secret HOT 3
- Error installing extension from marketplace HOT 2
- Terraform apply fails when deploying tfplan from artifactory in release pipeline HOT 2
- Terraform output failing, but not recorded as failed HOT 4
- Terraform: Unable to get latest version: using 1.1.6 HOT 3
- Azure SQL database management using Workload Identity Federation service connection in Azure DevOps HOT 4
- Allow Option to Override Subscription ID
- WIF token usage HOT 2
- Using WIF for Terraform State broken in 0.1.25 HOT 8
- Upgrade Node10 executor to Node16 HOT 2
- Allow for More Nuanced Terraform Versioning HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from azure-pipelines-terraform.