Skip to content

Commit a70eab5

Browse files
authored
Merge pull request #370 from magodo/rename
Rename command and brand name
2 parents d2896d5 + 9deea3e commit a70eab5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+388
-395
lines changed

README.md

+45-52
Large diffs are not rendered by default.

azure-pipelines.yml

+26-26
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ stages:
1515
- stage: build
1616
pool:
1717
name: pool-ubuntu-2004
18-
displayName: "Build aztfy"
18+
displayName: "Build"
1919
jobs:
2020
- job: build
2121
displayName: "Build Binaries"
@@ -54,9 +54,9 @@ stages:
5454
set -e
5555
REVISION=`git rev-parse --short HEAD`
5656
mkdir build
57-
name=aztfy
57+
name=aztfexport
5858
if [[ $OS = windows ]]; then
59-
name=aztfy.exe
59+
name=aztfexport.exe
6060
fi
6161
GOOS="${OS}" GOARCH="${ARCH}" CGO_ENABLED=0 go build -trimpath -ldflags="-s -w -X 'main.version=${VERSION}' -X 'main.revision=${REVISION}'" -o build/$name
6262
displayName: "Go Build"
@@ -123,7 +123,7 @@ stages:
123123
ARCH: amd64
124124
steps:
125125
- task: DownloadPipelineArtifact@2
126-
displayName: "Download aztfy binary"
126+
displayName: "Download binary"
127127
inputs:
128128
artifact: windows-$(ARCH)
129129
path: $(system.defaultWorkingDirectory)/dist/bin
@@ -147,10 +147,10 @@ stages:
147147
cd $workdir/scripts/package/windows/build
148148
declare -A map=( [386]=x86 [amd64]=x64 )
149149
export VERSION=${VERSION:1}
150-
cp $workdir/dist/bin/aztfy.exe .
150+
cp $workdir/dist/bin/aztfexport.exe .
151151
candle.exe -arch ${map[$ARCH]} -o setup.wxobj ./setup.wxs
152152
mkdir $workdir/dist/output
153-
light.exe -out $workdir/dist/output/aztfy.msi ./setup.wxobj
153+
light.exe -out $workdir/dist/output/aztfexport.msi ./setup.wxobj
154154
env:
155155
workdir: $(system.defaultWorkingDirectory)
156156
VERSION: ${{ parameters.version }}
@@ -230,52 +230,52 @@ stages:
230230
- script: |
231231
set -e
232232
233-
chmod +x $WORKDIR/dist/source/aztfy
233+
chmod +x $WORKDIR/dist/source/aztfexport
234234
235235
declare -A deb_arch_map=( [386]=i386 [amd64]=amd64 [arm]=armhf [arm64]=arm64 )
236236
declare -A rpm_arch_map=( [386]=i686 [amd64]=x86_64 [arm]=armv7hl [arm64]=aarch64 )
237237
version=${VERSION:1}
238238
239239
# Build the image
240240
cd $WORKDIR/scripts/package/linux/build
241-
docker build -t aztfybuild .
241+
docker build -t aztfexportbuild .
242242
243243
# Build deb package
244244
docker run -t --rm \
245245
-v $WORKDIR/dist/source:/build/source \
246246
-v $WORKDIR/dist/output:/build/output \
247-
aztfybuild \
247+
aztfexportbuild \
248248
fpm \
249-
--name aztfy \
249+
--name aztfexport \
250250
--license MPL-2.0 \
251251
--version $version \
252252
--description "A tool to bring existing Azure resources under Terraform's management" \
253-
--url "https://github.com/Azure/aztfy" \
253+
--url "https://github.com/Azure/aztfexport" \
254254
--maintainer "magodo <[email protected]>" \
255255
--input-type dir \
256256
--output-type deb \
257257
--architecture ${deb_arch_map[$ARCH]} \
258-
--package /build/output/aztfy-$version-1-${deb_arch_map[$ARCH]}.deb \
259-
/build/source/aztfy=/usr/bin/aztfy
258+
--package /build/output/aztfexport-$version-1-${deb_arch_map[$ARCH]}.deb \
259+
/build/source/aztfexport=/usr/bin/aztfexport
260260
261261
# Build rpm package
262262
echo $version
263263
docker run -t --rm \
264264
-v $WORKDIR/dist/source:/build/source \
265265
-v $WORKDIR/dist/output:/build/output \
266-
aztfybuild \
266+
aztfexportbuild \
267267
fpm \
268-
--name aztfy \
268+
--name aztfexport \
269269
--license MPL-2.0 \
270270
--version ${version} \
271271
--description "A tool to bring existing Azure resources under Terraform's management" \
272-
--url "https://github.com/Azure/aztfy" \
272+
--url "https://github.com/Azure/aztfexport" \
273273
--maintainer "magodo <[email protected]>" \
274274
--input-type dir \
275275
--output-type rpm \
276276
--architecture ${rpm_arch_map[$ARCH]} \
277-
--package /build/output/aztfy-$version-1-${rpm_arch_map[$ARCH]}.rpm \
278-
/build/source/aztfy=/usr/bin/aztfy
277+
--package /build/output/aztfexport-$version-1-${rpm_arch_map[$ARCH]}.rpm \
278+
/build/source/aztfexport=/usr/bin/aztfexport
279279
displayName: "Build Packages"
280280
env:
281281
VERSION: ${{ parameters.version }}
@@ -334,7 +334,7 @@ stages:
334334
runId: ${{ parameters.artifactBuildId }}
335335
- script: |
336336
set -e
337-
NAME="aztfy"
337+
NAME="aztfexport"
338338
OS_ARCH=(
339339
"windows:amd64"
340340
"windows:386"
@@ -349,17 +349,17 @@ stages:
349349
for os_arch in "${OS_ARCH[@]}" ; do
350350
OS=${os_arch%%:*}
351351
ARCH=${os_arch#*:}
352-
name=aztfy
352+
name=aztfexport
353353
if [[ $OS = windows ]]; then
354-
name=aztfy.exe
354+
name=aztfexport.exe
355355
fi
356356
chmod +x dist/${OS}-${ARCH}/${name}
357357
zip -j release/${NAME}_${VERSION}_${OS}_${ARCH}.zip dist/${OS}-${ARCH}/${name}
358358
done
359359
360360
# Copy MSI
361-
cp dist/windows-386-msi/aztfy.msi release/${NAME}_${VERSION}_x86.msi
362-
cp dist/windows-amd64-msi/aztfy.msi release/${NAME}_${VERSION}_x64.msi
361+
cp dist/windows-386-msi/aztfexport.msi release/${NAME}_${VERSION}_x86.msi
362+
cp dist/windows-amd64-msi/aztfexport.msi release/${NAME}_${VERSION}_x64.msi
363363
364364
cd release
365365
shasum -a 256 *.zip *.msi > ${NAME}_SHA256SUMS
@@ -397,7 +397,7 @@ stages:
397397
git config user.name "azure-terraform-bot"
398398
git config user.email "[email protected]"
399399
git tag -a "${VERSION}" -m "${VERSION}"
400-
git push https://${PAT}@github.com/Azure/aztfy.git --tags
400+
git push https://${PAT}@github.com/Azure/aztfexport.git --tags
401401
displayName: "Create and Push a Git Release"
402402
env:
403403
VERSION: ${{ parameters.version }}
@@ -665,7 +665,7 @@ stages:
665665
iwr https://aka.ms/wingetcreate/latest -OutFile wingetcreate.exe
666666
git clone https://github.com/microsoft/winget-pkgs.git
667667
cd winget-pkgs
668-
..\wingetcreate.exe update --urls https://github.com/Azure/aztfy/releases/download/$env:VERSION/aztfy_$($env:VERSION)_x64.msi https://github.com/Azure/aztfy/releases/download/$env:VERSION/aztfy_$($env:VERSION)_x86.msi --version $env:VERSION.Substring(1) --submit --token $env:PAT Microsoft.Azure.Aztfy
668+
..\wingetcreate.exe update --urls https://github.com/Azure/aztfexport/releases/download/$env:VERSION/aztfexport_$($env:VERSION)_x64.msi https://github.com/Azure/aztfexport/releases/download/$env:VERSION/aztfexport_$($env:VERSION)_x86.msi --version $env:VERSION.Substring(1) --submit --token $env:PAT Microsoft.Azure.AztfExport
669669
displayName: "Create PR"
670670
env:
671671
VERSION: ${{ parameters.version }}
@@ -692,7 +692,7 @@ stages:
692692
cd "$(brew --repository homebrew/core)"
693693
git config user.name "azure-terraform-bot"
694694
git config user.email "[email protected]"
695-
HOMEBREW_GITHUB_API_TOKEN=${PAT} brew bump-formula-pr --version=${VERSION:1} --no-browse --force aztfy
695+
HOMEBREW_GITHUB_API_TOKEN=${PAT} brew bump-formula-pr --version=${VERSION:1} --no-browse --force aztfexport
696696
displayName: "Create PR"
697697
env:
698698
VERSION: ${{ parameters.version }}

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module github.com/Azure/aztfy
1+
module github.com/Azure/aztfexport
22

33
go 1.19
44

internal/cfgfile/cfg.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
"github.com/tidwall/sjson"
1212
)
1313

14-
const CfgDirName = ".aztfy"
14+
const CfgDirName = ".aztfexport"
1515
const CfgFileName = "config.json"
1616

1717
type Configuration struct {

internal/config/config_interactive.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package config
22

3-
import "github.com/Azure/aztfy/pkg/config"
3+
import "github.com/Azure/aztfexport/pkg/config"
44

55
type InteractiveModeConfig struct {
66
config.Config

internal/config/config_noninteractive.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package config
22

3-
import "github.com/Azure/aztfy/pkg/config"
3+
import "github.com/Azure/aztfexport/pkg/config"
44

55
type NonInteractiveModeConfig struct {
66
config.Config

internal/meta/base_meta.go

+15-15
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ import (
99
"path/filepath"
1010
"strings"
1111

12-
"github.com/Azure/aztfy/pkg/config"
13-
"github.com/Azure/aztfy/pkg/log"
12+
"github.com/Azure/aztfexport/pkg/config"
13+
"github.com/Azure/aztfexport/pkg/log"
1414
"github.com/zclconf/go-cty/cty"
1515

16-
"github.com/Azure/aztfy/internal/client"
17-
"github.com/Azure/aztfy/internal/resmap"
18-
"github.com/Azure/aztfy/internal/utils"
19-
"github.com/Azure/aztfy/pkg/telemetry"
16+
"github.com/Azure/aztfexport/internal/client"
17+
"github.com/Azure/aztfexport/internal/resmap"
18+
"github.com/Azure/aztfexport/internal/utils"
19+
"github.com/Azure/aztfexport/pkg/telemetry"
2020
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
2121
"github.com/Azure/azure-sdk-for-go/sdk/azcore/arm"
2222
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources"
@@ -33,15 +33,15 @@ import (
3333
"github.com/magodo/workerpool"
3434
)
3535

36-
const ResourceMappingFileName = "aztfyResourceMapping.json"
37-
const SkippedResourcesFileName = "aztfySkippedResources.txt"
36+
const ResourceMappingFileName = "aztfexportResourceMapping.json"
37+
const SkippedResourcesFileName = "aztfexportSkippedResources.txt"
3838

3939
type TFConfigTransformer func(configs ConfigInfos) (ConfigInfos, error)
4040

4141
type BaseMeta interface {
42-
// Init initializes aztfy, including initialize terraform, provider and soem runtime temporary resources.
42+
// Init initializes the base meta, including initialize terraform, provider and soem runtime temporary resources.
4343
Init(ctx context.Context) error
44-
// DeInit deinitializes aztfy, including cleaning up runtime temporary resources.
44+
// DeInit deinitializes the base meta, including cleaning up runtime temporary resources.
4545
DeInit(ctx context.Context) error
4646
// Workspace returns the path of the output directory.
4747
Workspace() string
@@ -58,7 +58,7 @@ type BaseMeta interface {
5858
ExportSkippedResources(ctx context.Context, l ImportList) error
5959
// ExportResourceMapping writes a resource mapping file to the output directory.
6060
ExportResourceMapping(ctx context.Context, l ImportList) error
61-
// CleanUpWorkspace is a weired method that is only meant to be used internally by aztfy, which under the hood will remove everything in the output directory, except the generated TF config.
61+
// CleanUpWorkspace is a weired method that is only meant to be used internally by aztfexport, which under the hood will remove everything in the output directory, except the generated TF config.
6262
// This method does nothing if HCLOnly in the Config is not set.
6363
CleanUpWorkspace(ctx context.Context) error
6464
}
@@ -226,7 +226,7 @@ func (meta *baseMeta) Init(ctx context.Context) error {
226226
}
227227
}
228228
for i := 0; i < meta.parallelism; i++ {
229-
dir, err := os.MkdirTemp("", "aztfy-")
229+
dir, err := os.MkdirTemp("", "aztfexport-")
230230
if err != nil {
231231
return fmt.Errorf("creating import directory: %v", err)
232232
}
@@ -321,7 +321,7 @@ func (meta *baseMeta) ParallelImport(ctx context.Context, items []*ImportItem) e
321321

322322
// Performance improvement.
323323
// In case there is no TF state in the target workspace (no matter local/remote backend), we can avoid using tfmerge (which takes care of terraform internals, like keeping the lineage, etc).
324-
// As long as the user ensure there is no address conflicts in the import list (which is always the case by aztfy as the resource names are almost unique),
324+
// As long as the user ensure there is no address conflicts in the import list (which is always the case as the resource names are almost unique),
325325
// We are updating the local thisBaseStateJSON here, will update it to the meta.baseState at the end of this function.
326326
if len(meta.originBaseState) == 0 {
327327
log.Printf("[DEBUG] Merging terraform state file %s (simple)", stateFile)
@@ -406,7 +406,7 @@ func (meta baseMeta) PushState(ctx context.Context) error {
406406
if baseState != string(meta.originBaseState) {
407407
edits := myers.ComputeEdits(span.URIFromPath("origin.tfstate"), string(meta.originBaseState), baseState)
408408
changes := fmt.Sprint(gotextdiff.ToUnified("origin.tfstate", "current.tfstate", string(meta.originBaseState), edits))
409-
return fmt.Errorf("there is out-of-band changes on the state file during running aztfy:\n%s", changes)
409+
return fmt.Errorf("there is out-of-band changes on the state file:\n%s", changes)
410410
}
411411

412412
// Create a temporary state file to hold the merged states, then push the state to the output directory.
@@ -715,7 +715,7 @@ func (meta *baseMeta) importItem(ctx context.Context, item *ImportItem, importId
715715
tf := meta.importTFs[importIdx]
716716

717717
// Construct the empty cfg file for importing
718-
cfgFile := filepath.Join(moduleDir, "tmp.aztfy.tf")
718+
cfgFile := filepath.Join(moduleDir, "tmp.aztfexport.tf")
719719
tpl := fmt.Sprintf(`resource "%s" "%s" {}`, item.TFAddr.Type, item.TFAddr.Name)
720720
// #nosec G306
721721
if err := os.WriteFile(cfgFile, []byte(tpl), 0644); err != nil {

internal/meta/importlist.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package meta
22

33
import (
4-
"github.com/Azure/aztfy/internal/tfaddr"
4+
"github.com/Azure/aztfexport/internal/tfaddr"
55
"github.com/magodo/armid"
66
)
77

internal/meta/meta_map.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ import (
77
"os"
88
"sort"
99

10-
"github.com/Azure/aztfy/pkg/config"
11-
"github.com/Azure/aztfy/pkg/log"
10+
"github.com/Azure/aztfexport/pkg/config"
11+
"github.com/Azure/aztfexport/pkg/log"
1212

13-
"github.com/Azure/aztfy/internal/resmap"
14-
"github.com/Azure/aztfy/internal/tfaddr"
13+
"github.com/Azure/aztfexport/internal/resmap"
14+
"github.com/Azure/aztfexport/internal/tfaddr"
1515
"github.com/magodo/armid"
1616
)
1717

internal/meta/meta_query.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ import (
44
"context"
55
"fmt"
66

7-
"github.com/Azure/aztfy/internal/resourceset"
8-
"github.com/Azure/aztfy/internal/tfaddr"
9-
"github.com/Azure/aztfy/pkg/config"
10-
"github.com/Azure/aztfy/pkg/log"
7+
"github.com/Azure/aztfexport/internal/resourceset"
8+
"github.com/Azure/aztfexport/internal/tfaddr"
9+
"github.com/Azure/aztfexport/pkg/config"
10+
"github.com/Azure/aztfexport/pkg/log"
1111
"github.com/magodo/azlist/azlist"
1212
)
1313

internal/meta/meta_res.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ import (
44
"context"
55
"fmt"
66

7-
"github.com/Azure/aztfy/internal/resourceset"
8-
"github.com/Azure/aztfy/internal/tfaddr"
9-
"github.com/Azure/aztfy/pkg/config"
10-
"github.com/Azure/aztfy/pkg/log"
7+
"github.com/Azure/aztfexport/internal/resourceset"
8+
"github.com/Azure/aztfexport/internal/tfaddr"
9+
"github.com/Azure/aztfexport/pkg/config"
10+
"github.com/Azure/aztfexport/pkg/log"
1111
"github.com/magodo/armid"
1212
"github.com/magodo/aztft/aztft"
1313
)
@@ -56,7 +56,7 @@ func (meta *MetaResource) ListResource(_ context.Context) (ImportList, error) {
5656

5757
// This is to record known resource types. In case there is a known resource type and there comes another same typed resource,
5858
// then we need to modify the resource name. Otherwise, there will be a resource address conflict.
59-
// See https://github.com/Azure/aztfy/issues/275 for an example.
59+
// See https://github.com/Azure/aztfexport/issues/275 for an example.
6060
rtCnt := map[string]int{}
6161

6262
var l ImportList

internal/meta/meta_rg.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ import (
44
"context"
55
"fmt"
66

7-
"github.com/Azure/aztfy/internal/resourceset"
8-
"github.com/Azure/aztfy/internal/tfaddr"
9-
"github.com/Azure/aztfy/pkg/config"
10-
"github.com/Azure/aztfy/pkg/log"
7+
"github.com/Azure/aztfexport/internal/resourceset"
8+
"github.com/Azure/aztfexport/internal/tfaddr"
9+
"github.com/Azure/aztfexport/pkg/config"
10+
"github.com/Azure/aztfexport/pkg/log"
1111
"github.com/magodo/armid"
1212
"github.com/magodo/azlist/azlist"
1313
)

internal/resourceset/azure_resource_set.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package resourceset
33
import (
44
"sort"
55

6-
"github.com/Azure/aztfy/pkg/log"
6+
"github.com/Azure/aztfexport/pkg/log"
77
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
88
"github.com/Azure/azure-sdk-for-go/sdk/azcore/arm"
99

internal/run.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ import (
66
"os"
77
"strings"
88

9-
internalmeta "github.com/Azure/aztfy/internal/meta"
9+
internalmeta "github.com/Azure/aztfexport/internal/meta"
1010

11-
"github.com/Azure/aztfy/internal/config"
12-
"github.com/Azure/aztfy/pkg/meta"
11+
"github.com/Azure/aztfexport/internal/config"
12+
"github.com/Azure/aztfexport/pkg/meta"
1313

14-
"github.com/Azure/aztfy/internal/ui/common"
14+
"github.com/Azure/aztfexport/internal/ui/common"
1515
bspinner "github.com/charmbracelet/bubbles/spinner"
1616
"github.com/magodo/spinner"
1717
)

internal/test/cases/case.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package cases
22

33
import (
4-
"github.com/Azure/aztfy/internal/resmap"
5-
"github.com/Azure/aztfy/internal/test"
4+
"github.com/Azure/aztfexport/internal/resmap"
5+
"github.com/Azure/aztfexport/internal/test"
66
)
77

88
type SingleResourceContext struct {

0 commit comments

Comments
 (0)