terraform plan -var-file=uservar.tfvars
[0m[1mRefreshing Terraform state in-memory prior to plan...[0m
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.
[0m
[31mError refreshing state: 1 error(s) occurred:
* provider.aws: InvalidClientTokenId: The security token included in the request is invalid.
status code: 403, request id: 39888d7e-b3f1-11e7-b6d2-9b6dc0727868[0m[0m
Build step 'Execute shell' marked build as failure
Finished: FAILURE
答案 0 :(得分:0)
您需要先运行terraform init
,然后再运行terraform plan
首先阅读本文档:terraform Command: init
其次,对于错误The security token included in the request is invalid.
,请通过aws configuration确保您已正确设置AWS安全令牌。
答案 1 :(得分:0)
我得到了这个决议。 你从Git中提取代码吗?如果是,请只拉一次
注意:Git上的代码没有access_key和secret_key,因此如果您的jenkins作业包含每个构建的源代码控制,则会覆盖值(access_key和secret_key)。 - >只拉一次代码 - >在你的jenkins / workspace中,设置你的access_key和secret_Key(或者你也可以在Jenkins Build中提及它)
在执行Jenkins作业之前,设置aws cli参数 配置 设置access_key,secret_key&区域
然后执行 terraform init terraform plan -var-file = uservar.tfvars