首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >破坏地形资源的游戏手册

破坏地形资源的游戏手册
EN

Stack Overflow用户
提问于 2022-07-11 10:22:29
回答 1查看 228关注 0票数 0

我使用ansible剧本创建Azure资源,触发terraform代码。我想毁掉资源。下面是创建和破坏的代码。

创建

代码语言:javascript
复制
    - block:
      - name: Run virtual-machine terraform - Planned
        terraform:
          project_path: xxxx
          state: planned
          force_init: true
          plan_file: "xxxx.plan"
          backend_config:
            resource_group_name: "rg-poc-automation"
            storage_account_name: "smartopsazureautomation"
            container_name: "terraformstatefile"
            key: "{{ _customer }}-{{ enviornment }}-vm-config.tfstate" 
      
      - name: Run virtual-machine terraform - Present
        terraform:
          project_path: xxxxx
          state: present
          force_init: true
          plan_file: "xxxxx.plan"
          backend_config:
            resource_group_name: "rg-poc-automation"
            storage_account_name: "smartopsazureautomation"
            container_name: "terraformstatefile"
            key: "{{ _customer }}-{{ enviornment }}-vm-config.tfstate" 

破坏

代码语言:javascript
复制
    - block:   
      - name: Run virtual-machine terraform - Absent
        terraform:
          project_path: xxxxx
          state: absent
          force_init: false
          plan_file: "xxxx.plan"
          backend_config:
            resource_group_name: "rg-poc-automation"
            storage_account_name: "smartopsazureautomation"
            container_name: "terraformstatefile"
            key: "{{ _customer }}-{{ enviornment }}-vm-config.tfstate" 
      environment: "{{ env }}"    

我们在销毁时得到以下错误。这是因为terraform的最新版本已经不推荐-force,而剧本正在以某种方式接受它。有什么办法可以解决这个问题吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2022-07-13 09:02:44

因为旧版本没有最新的terraform版本更改,所以在我们升级我们的ansible版本之后,它就起了作用。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/72937055

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档