Skip to content

Commit

Permalink
Merge branch 'main' of github.com:magodo/aztfy
Browse files Browse the repository at this point in the history
  • Loading branch information
magodo committed Oct 29, 2021
2 parents a2e6b74 + 1426009 commit 457ada8
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Attach to Process",
"type": "go",
"request": "attach",
"mode": "local",
"processId": 0
}
]
}
46 changes: 46 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,49 @@ For example, the `azurerm_lb_backend_address_pool_address` is actually a propert
Another popular case is that in the AzureRM provider, there are a bunch of "association" resources, e.g. the `azurerm_network_interface_security_group_association`. These "association" resources represent the association relationship between two Terraform resources (in this case they are `azurerm_network_interface` and `azurerm_network_security_group`). They also have some synthetic resource ID, e.g. `/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/microsoft.network/networkInterfaces/example|/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Network/networkSecurityGroups/group1`.

Currently, this tool only works on the assumption that there is 1:1 mapping between Azure resources and the Terraform resources.

## How to develop with vscode

### vs pre requiries
1. Install Go extension from "Go Team at Google"

1. Install dependencies when ask in the editor.

1. Build without optimision
go build -gcflags=all="-N -l"
(To run, in context of the folder)

1. Add some code in the main.go to stop the init.

```
var reader = bufio.NewReader(os.Stdin)
os.Setenv("AZTFY_DEBUG", "true")
os.Setenv("AZTFY_MOCK_CLIENT", "false")
os.Setenv("AZTFY_LOGFILE", "aztfylogs.log")
log.Println("Main hitted")
input, _ := reader.ReadString('\n')
value := strings.TrimSpace(input)
fmt.Printf("input: %v", value)
```

2. Run app
```
./aztfy rg-my-demo
```

1. Get pid of the app
- Linux : pgrep aztfy
- Windows : Task manager / tab detail

2. Update launch setting processId with pid
(Sample in folder .vscode\launch.json)

3. launch debug session

4. Press enter




0 comments on commit 457ada8

Please sign in to comment.