小编Rav*_*ran的帖子

如何在terraform中解密windows管理员密码?

我正在配置单个Windows服务器,以便在AWS中使用terraform进行测试.每次我需要用我的PEM文件解密我的Windows密码才能连接.相反,我选择了terraform参数get_password_data并将其存储password_data在tfstate文件中.现在我如何使用插值语法解密相同的内容rsadecrypt

请找到我的以下terraform代码

### Resource for EC2 instance creation ###

resource "aws_instance" "ec2" {
  ami                   =   "${var.ami}"
  instance_type         =   "${var.instance_type}"
  key_name              =   "${var.key_name}"
  subnet_id             =   "${var.subnet_id}"
  security_groups       =  ["${var.security_groups}"]
  availability_zone     =   "${var.availability_zone}"
  private_ip            =   "x.x.x.x"
  get_password_data     =   "true"

  connection {
    password            =   "${rsadecrypt(self.password_data)}"
    }

  root_block_device {
              volume_type = "${var.volume_type}"
              volume_size = "${var.volume_size}"
    delete_on_termination = "true"
    }

  tags {
        "Cost Center"  =  "R1"
        "Name"         =  "AD-test"
        "Purpose"      =  "Task"
        "Server Name"  =  "Active Directory"
        "SME Name"     = …
Run Code Online (Sandbox Code Playgroud)

syntax interpolation amazon-web-services terraform

8
推荐指数
1
解决办法
2851
查看次数