Code Monkey home page Code Monkey logo

Comments (12)

andyt530 avatar andyt530 commented on July 21, 2024

Can you give me a little more of the output - before and after.

from py-az2tf.

zoemac11 avatar zoemac11 commented on July 21, 2024

terraform validate Success! The configuration is valid. chmod: cannot access 'state.sh': No such file or directory state cleaned ls: cannot access '**stateimp.sh': No such file or directory imports completed Terraform fmt ... azure.tf Terraform Plan ... 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. ------------------------------------------------------------------------ No changes. Infrastructure is up-to-date.

from py-az2tf.

andyt530 avatar andyt530 commented on July 21, 2024

And can you share:

  1. The actually command line you are running ./az2tf.sh ......
  2. The output between that command and the terraform validate Success!
  3. are there any *.tf files being generated in the sub-directory generated/tf. ?

Thanks

from py-az2tf.

zoemac11 avatar zoemac11 commented on July 21, 2024

Its generating file but its empty, only contains terraform and provider 'azurerm'. Ive removed my subscription ID

./az2tf.sh -s

Subscription ID =
Azure Resource Group Filter =
Terraform Resource Type Filter =
Get Subscription Policies & RBAC = no
Extract Key Vault Secrets to .tf files (insecure) = no
Fast Forward = no
Validate Only = no
Debug = no

python2.7 ../../scripts/az2tf.py -s 2>&1 | tee -a import.log
./az2tf.sh: line 123: python2.7: command not found
terraform init

Initializing the backend...

Initializing provider plugins...

  • Checking for available provider plugins...
  • Downloading plugin for provider "azurerm" (terraform-providers/azurerm) 1.31.0...

Terraform has been successfully initialized!

You may now begin working with Terraform. Try running "terraform plan" to see
any changes that are required for your infrastructure. All Terraform commands
should now work.

If you ever set or change modules or backend configuration for Terraform,
rerun this command to reinitialize your working directory. If you forget, other
commands will detect it and remind you to do so if necessary.
terraform validate
Success! The configuration is valid.

from py-az2tf.

andyt530 avatar andyt530 commented on July 21, 2024

Ah - here's the problem:

python2.7 ../../scripts/az2tf.py -s 2>&1 | tee -a import.log
./az2tf.sh: line 123: python2.7: command not found

It couldn't find python v 2.7 on your system - so the main bulk of the code that generates the terraform didn't run

I'll code in a test to drop out with a better error......

In the meantime - unless you can run "python2.7" - or alias that to python v2 on your system this isn't going to work for you....

from py-az2tf.

zoemac11 avatar zoemac11 commented on July 21, 2024

If i run python it works fine and shows that its version 2.7

$ python --version Python 2.7.16

from py-az2tf.

andyt530 avatar andyt530 commented on July 21, 2024

Hi,

There are many many ways python can get installed and be available on the command line.
I'll have to work some more logic in to cover all these cases.

In the meantime you should be able to work-around simple by changing that "python2.7" to "python" in the az2tf.sh file (line 91)

If you have the time could you please give that a try and let me know how you get on ?

Thanks

from py-az2tf.

zoemac11 avatar zoemac11 commented on July 21, 2024

Thanks! I'm now getting the following errors

python ../../scripts/az2tf.py -s 7e42623b-2051-4ab2-a66b-36b5866ac99b 2>&1 | tee -a import.log Get Access Token from CLI Subscription: 7e42623b-2051-4ab2-a66b-36b5866ac99b Traceback (most recent call last): File "../../scripts/az2tf.py", line 200, in r = requests.get(url, headers=headers, params=params) File "C:\Users\AppData\Roaming\Python\Python27\site-packages\reques ts\api.py", line 75, in get return request('get', url, params=params, **kwargs) File "C:\Users\AppData\Roaming\Python\Python27\site-packages\reques ts\api.py", line 60, in request return session.request(method=method, url=url, **kwargs) File "C:\Users\AppData\Roaming\Python\Python27\site-packages\reques ts\sessions.py", line 519, in request prep = self.prepare_request(req) File "C:\Users\AppData\Roaming\Python\Python27\site-packages\reques ts\sessions.py", line 462, in prepare_request hooks=merge_hooks(request.hooks, self.hooks), File "C:\Users\AppData\Roaming\Python\Python27\site-packages\reques ts\models.py", line 314, in prepare self.prepare_headers(headers) File "C:\Users\AppData\Roaming\Python\Python27\site-packages\reques ts\models.py", line 448, in prepare_headers check_header_validity(header) File "C:\Users\AppData\Roaming\Python\Python27\site-packages\reques ts\utils.py", line 942, in check_header_validity raise InvalidHeader("Invalid return character or leading space in header: %s " % name) requests.exceptions.InvalidHeader: Invalid return character or leading space in header: Authorization terraform init

from py-az2tf.

andyt530 avatar andyt530 commented on July 21, 2024

Hi,

Two things to try:

  1. sudo pip install requests
  2. have you logged in to azure via the CLI ?

Thanks

from py-az2tf.

zoemac11 avatar zoemac11 commented on July 21, 2024

The issue is with the request module. Couldnt get it to work but thanks

from py-az2tf.

andyt530 avatar andyt530 commented on July 21, 2024

When you fix that - it should be ok

from py-az2tf.

peter-mogaka avatar peter-mogaka commented on July 21, 2024

having the same issue. I have python 3 and installed pip requests and pip adal.
@zoemac11 How did you solve this error?
@andyt530 can't find line 91 on the az2tf.sh file

2021-04-28 13_17_48-az2tf sh - Visual Studio Code

from py-az2tf.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.