Граф коммитов

80 Коммитов

Автор SHA1 Сообщение Дата
magodo ebf167e135
CLI: Expose `--plain-ui` to be used in environment that has no /dev/tty (#423) 2023-07-10 09:46:29 +08:00
magodo 4d26f5fe0a Resource mapping file will now be generated together with the `import.tf` that is the TF plannable import blocks 2023-05-16 11:48:10 +08:00
magodo 852f37db2b
Telemetry collect subscription ID (#389)
* Collect subscription id in telemetry

* Separating the error trace to 2, so that we only need to redacate the details

* Split aztfexport end error to 2

* Fix a minor bug in the effective cli arg
2023-04-25 09:00:00 +08:00
magodo 66596c4e4e
New CLI options: `--use-environment-cred`, `--use-managed-identiy-cred` and `--use-azure-cli-cred` to allow users to explicitly choose auth method instead of the default auth chain (#390)
* New CLI options: `--use-environment-cred`, `--use-managed-identiy-cred` and `--use-azure-cli-cred` to allow users to explicitly choose auth method instead of the default auth chain

* test cases for the new cli options
2023-04-17 14:11:27 +08:00
magodo b794b083c7
Integrate with terraform-client-go for hcl only mode to eliminate `terraform` binary (#381)
* Integrate with terraform-client-go for hcl only mode to eliminate `terraform` binary

Integrate with terraform-client-go for hcl only mode to eliminate `terraform` binary. This improves the performance (quicker speed and lower footprint) of importing.

To use it, users have to explicitly specify a new hidden flag (`--tfclient-plugin-go`). This flag is hidden since it is not supposed for CLI users to use, but is meant to be used by module users who wants to get the benefit of performance improvement.
2023-03-29 10:03:52 +08:00
magodo 19b00eca4e
New option: "--env" (#378) 2023-03-15 14:30:17 +08:00
magodo 890a944117
New option: `--provider-version` to overwrite the provider version used for importing (other than using the bound version) (#376)
* New option: `--provider-version` to overwrite the provider version used for importing (other than using the bound version)

* Determine the provider version constraint under used if not specified
2023-03-14 09:41:12 +08:00
magodo 40c9d05519
Add trace for effective CLI being issued (with non-interesting/sensitive flags removed) (#374) 2023-03-14 09:40:58 +08:00
magodo 9ed90aea08
Extend `--append` to remote backend, and the backend type now honors the existing type in append mode (#373)
* Extend `--append` to remote backend, and the backend type now honors the existing type in append mode

* Pass CI

* Update readme
2023-03-09 09:34:49 +08:00
magodo 2cf388c316
rename the code 2023-03-06 12:42:33 +08:00
Steven f472951097
Update help prompts and outputs (#367)
* Update help prompts and outputs

Fixing grammar or clarity on specific prompts to help with usability.

* Update main.go

Co-authored-by: magodo <wztdyl@sina.com>

* Update main.go

Co-authored-by: magodo <wztdyl@sina.com>

* Update main.go

Co-authored-by: magodo <wztdyl@sina.com>

* Update main.go

Co-authored-by: magodo <wztdyl@sina.com>

* Update main.go

Co-authored-by: magodo <wztdyl@sina.com>

* Update main.go

Co-authored-by: magodo <wztdyl@sina.com>

* Update main.go

Co-authored-by: magodo <wztdyl@sina.com>

* Update main.go

Co-authored-by: magodo <wztdyl@sina.com>

---------

Co-authored-by: magodo <wztdyl@sina.com>
2023-03-02 09:36:34 +08:00
magodo b6afcc599c Revert "Updating help prompts"
This reverts commit e1507b4bf1.
2023-03-01 11:18:05 +08:00
Steven Ma e1507b4bf1 Updating help prompts
Cleaning up --help prompts (grammar/typos/etc)
2023-02-28 10:51:38 -08:00
magodo 0d756553c0 Mkdir for output dir if not exists 2023-02-28 14:38:39 +08:00
magodo 0b7ee290b3 Fix `--append` sneaks to be used together with `--hcl-only` in interactive mode 2023-02-23 16:57:04 +08:00
magodo bb313d2df3 Merge remote-tracking branch 'upstream/main' into telemetry 2023-02-17 17:24:30 +08:00
magodo 351e26744f Move impl detail of cfgfile to cfgfile package 2023-02-16 11:54:45 +08:00
magodo c78dad6c8d Allow resource mapping file in the output directory in `map` mode 2023-02-16 11:30:02 +08:00
magodo b531cf63cb New command `config [get|set|show]` and collecting telemetry 2023-02-16 10:13:57 +08:00
magodo cfd9df2fdd
New hidden option: `--profile <cpu|mem>` 2023-02-01 12:56:53 +08:00
magodo a8965e09a4
`Config` now replaces `.Append` by `.OutputFileNames` to be more clear 2023-01-31 13:55:30 +08:00
magodo 69274d834a
`CommonConfig` explicitly takes Azure SDK credential, client option and additional provider configs from caller (#346)
* `CommonConfig` takes Azure SDK credential and client option from caller

* `CommonConfig` adds `ProviderConfigs` to allow module users to specify additional provider configs explicitly (instead of via env var)

* pass gosec
2023-01-30 14:31:38 +08:00
magodo be78ecfd87
Parallelize initializing provider in the importing directories (#341)
* parallelize init

* Add error log for importing error

* go mod tidy
2023-01-19 11:25:58 +08:00
magodo c1805ba252
Expose some useful type/func to `pkg` to be called by external Go modules (#336)
* refactor

* Export ImportItem/List to pkg

* Remove meta2 reference

* Remove meta2 reference

* Move `Batch` out of `Config`

* Not chdir in test

* Remove write file sync

* Improve `ImportParalle` to allow it accept list longer than paralleism

* Differentiate exported Config and internally used cfg types for (non)interactive mode && add comments for exported types

* revert the vm acctest to use os profile ubuntu 16.04

* pass gosec

* `Meta` methods accept context
2023-01-18 13:01:35 +08:00
magodo 9498df7985 Support appending to existing module 2022-12-16 13:54:58 +08:00
magodo df017bb05d
Adding log level to CLI option and add more logs (#317)
* Add basic logging

* setup logging for azlist
2022-12-02 10:07:19 +08:00
magodo d40f4e0422
CLI adds `--output json` when querying subscription id (#316) 2022-11-30 09:34:02 +08:00
magodo 1f340700d0
Move the interactive output dir check code from `NewBaseMeta()` to CLI before function (#309)
Moving the interactive output dir check code from `NewBaseMeta()` to CLI before function as the `NewBaseMeta()` is meant to be used by 3rd-party modules, which is inappropriate to hold code requires user's interactions.
2022-11-23 14:54:18 +08:00
magodo c5ddece230
Make import in parallel the default implementation & remove the import one item 2022-10-28 15:02:12 +08:00
magodo b0c08baad0 Merge remote-tracking branch 'upstream/main' into parallel_import 2022-10-24 15:48:18 +08:00
magodo 996777aae4
Integrate with `gosec` to CI (#270) 2022-10-24 11:33:17 +08:00
magodo 83beb885a8 modify help message 2022-10-20 15:55:04 +08:00
magodo 83037b31a4
Batch import support parallel import 2022-10-13 19:25:56 +08:00
magodo 65fe5130b3
New option: `--hcl-only` to only keep the .tf files in the output directory, and removing the others (#246) 2022-09-30 14:16:33 +08:00
magodo b2cdc608a6
Bring the before func to command level (#245) 2022-09-30 11:02:02 +08:00
magodo 0e6af8baff
Remove the before func, inline in each cmd (#244) 2022-09-30 07:24:16 +08:00
magodo 4643a8da81
Merging `MetaRes` and `MetaGroup` to one (#243)
* Refactoring the all modes into its own meta and merge the ResMeta and GroupMeta to one.

* Pass tests and refactor main
2022-09-29 16:53:04 +08:00
magodo 40e559d8db
Renaming `--batch`/`-b` to `--non-interactive`/`-n` (#242) 2022-09-29 12:12:24 +08:00
magodo ec6dc86547
New subcommand: `map`/`mapping-file` to terrafy a predefined set of resources (#241)
This PR adds a new subcommand `map`/`mapping-file` to terrafy a predefined set of resources. This subcommand replaces the original way of specifying the resource mapping file by `-m` in either `query` or `rg` mode. As a result, the `-m` is removed from `query` and `rg` mode.

Relating to #222. More context can be found at: https://github.com/Azure/aztfy/issues/222#issuecomment-1260564510.
2022-09-29 11:59:28 +08:00
magodo 68c176ad8a
CLI option: `-g`/`--generate-mapping-file` to generate resource mapping file (#240)
* Introduce `-g`/`--generate-mapping-file` to only generate resouce mapping file

- In batch mode for `rg` and `query`, and also for `res`, `-g` will only generates resouce maping file, but not import any resource (interactive mode already has <kbd>s</kbd> for the same purpose)
- Remove the prefix dot of the resource mapping file and skipped resouces file names, to make it noticebale for Linux/Mac users
- `res` mode now also exports resource mapping file on a successful run

* Making the key of resource mapping file case sensitive (to make the key usable for res mode)
2022-09-28 16:34:55 +08:00
magodo 2f5c5cfaef
Single resource mode supports resource population and depedency
E.g. `aztfy res <vm id>` now might terrafies three resources: vm, managed disk and disk attachement.
2022-09-23 17:12:13 +08:00
magodo 9cd67a8da5 Add short name `-r` for `--recursive` 2022-09-22 17:55:25 +08:00
magodo 00bbc3685c `--parallelism`: remove mentioning import 2022-09-22 17:25:05 +08:00
magodo e25c50a0e5 ARG query changes to where predicate && Introduce `--recursive` in query mode to support both scope/specific predicates 2022-09-21 19:10:23 +08:00
magodo 465b83ecce Improve test cases
- Introduce a hidden flag `--plain-ui`, which is used for e2e test to stream the test output
- Add more stage related log during e2e test
- Introduce delay in e2e test right before apply, to wait for the created resources be recorded in ARG
2022-09-21 12:02:59 +08:00
magodo aa7bd75686
Integrate with github.com/magodo/azlist & Introduce `--parallelism` 2022-09-20 10:23:19 +08:00
magodo 6c1c0713d7 CLI changes to add new subcommand "query" 2022-09-14 11:11:00 +08:00
magodo c7d20848bc
opt rename: `--full` -> `--full-properties` (#214) 2022-09-09 08:18:11 +08:00
magodo f27a735ebf
New common option: `--full` to generate full HCL from TF state (#210)
New common option: `--full` to generate full HCL from TF state
2022-09-08 13:12:37 +08:00
magodo bb973a117a
Introduce `--type` in resource mode to allow users to explicitly set the TF resource type (#198) 2022-08-08 11:35:18 +08:00