我正在使用terraform创建和配置我的GCE实例。我已经在GCE接口上配置了4个接口,现在我希望此实例使用terraform来管理接口的外部IP。
对于aws,我们有一些
的概念output "ip" {
value = "${aws_eip.ip.public_ip}"
}
所以我想知道我是否可以使用等效的GCE。简而言之,我想将创建的实例的外部IP存储在本地实例中,最好存储在变量中
答案 0 :(得分:2)
我使用输出变量来获取实例创建过程中计算出的IP
@Echo Off
@Echo Scanning In Progress... This Will Take Several Time!!
Setlocal EnableExtensions EnableDelayedExpansion
set starttime=%time%
cd\
set Directory=Directory
set Date Created=Date Created
set Date Modified=Date Modified
set Date Accessed=Date Accessed
set FileName=FileName
Echo %Directory%,%Date Created%,%Date Modified%,%Date Accessed%,%FileName% >>c:\users\user\desktop\Result.csv
For /r "c:\" %%a in ("*.exe" "*.msi") DO (
@Echo %%a
For /f "tokens=1-4 delims=] " %%b in ('dir /tc "%%a" ^|find /n " " ^|find "[6]"') DO SET "datecreated=%%c %%d%%e"
For /f "tokens=1-4 delims=] " %%f in ('dir /tw "%%a" ^|find /n " " ^|find "[6]"') DO SET "datemodified=%%g %%h%%i"
For /f "tokens=1-4 delims=] " %%j in ('dir /ta "%%a" ^|find /n " " ^|find "[6]"') DO SET "dateaccessed=%%k %%l%%m"
For /f "tokens=6 delims=] " %%n in ('dir /tc "%%a" ^|find /n " " ^|find "[6]"') DO SET "filename=%%n"
Echo "%%a",!datecreated!,!datemodified!,!dateaccessed!,!filename! >>c:\users\user\desktop\Result.csv
)
set endtime=%time%
set /a hrs=%endtime:~0,2%
set /a hrs=%hrs%-%starttime:~0,2%
set /a mins=%endtime:~3,2%
set /a mins=%mins%-%starttime:~3,2%
set /a secs=%endtime:~6,2%
set /a secs=%secs%-%starttime:~6,2%
if %secs% lss 0 (
set /a secs=!secs!+60
set /a mins=!mins!-1
)
if %mins% lss 0 (
set /a mins=!mins!+60
set /a hrs=!hrs!-1
)
if %hrs% lss 0 (
set /a hrs=!hrs!+24
)
set /a tot=%secs%+%mins%*60+%hrs%*3600
Echo Start = %starttime%
Echo End = %endtime%
Echo Hours = %hrs%
Echo Minutes = %mins%
Echo Seconds = %secs%
Echo Total = %tot%
Echo Scanning Progress Compeleted!!
Endlocal
@pause