Skip to content

Commit

Permalink
Merge pull request hashicorp#12 from tensult/agent-install
Browse files Browse the repository at this point in the history
Rearranged agent-install
  • Loading branch information
koladilip authored Feb 13, 2019
2 parents 10179b1 + 7313342 commit 35ecf77
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 48 deletions.
48 changes: 0 additions & 48 deletions aws/agent-install/agent-windows.tf
Original file line number Diff line number Diff line change
@@ -1,51 +1,3 @@
resource "aws_ssm_document" "windows_awscli" {
name = "Install_AWSCLI_windows"
document_type = "Command"

content = <<DOC
{
"schemaVersion": "2.2",
"description": "Run a script to securely install Agent in Windows 2012 instance",
"mainSteps": [
{
"action":"aws:runPowerShellScript",
"name": "downloadAWSCLI",
"inputs":{
"runCommand":[
"mkdir 'C:\\Temp'\n",
"Invoke-WebRequest -Uri \"https://s3.amazonaws.com/aws-cli/AWSCLI64PY3.msi\" -OutFile 'C:\\Temp\\AWS_CLI.msi'\n",
"dir 'C:\\Temp\\'\n",
"echo 'AWS CLI is downloaded.'"
]
}
},
{
"action": "aws:applications",
"name": "installApplication",
"inputs": {
"parameters": "/quiet",
"action": "Install",
"source": "C:\\Temp\\AWS_CLI.msi"
}
},
{
"action":"aws:runPowerShellScript",
"name": "waitForAWSCLI",
"inputs":{
"runCommand":[
"while (!(Test-Path 'C:\\Program Files\\Amazon\\AWSCLI\\bin\\aws.cmd')){ Wait-Event -Timeout 10}\n",
"& 'C:\\Program Files\\Amazon\\AWSCLI\\bin\\aws.cmd'\n",
"echo 'AWS CLI is installed.'\n",
"Remove-Item -Path 'C:\\Temp\\AWS_CLI.msi'\n",
"Restart-Computer -Force"
]
}
}
]
}
DOC
}

resource "aws_ssm_document" "snow_agent_windows" {
name = "Snow_Agent_Windows"
document_type = "Command"
Expand Down
47 changes: 47 additions & 0 deletions aws/agent-install/aws-cli.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
resource "aws_ssm_document" "windows_awscli" {
name = "Install_AWSCLI_windows"
document_type = "Command"

content = <<DOC
{
"schemaVersion": "2.2",
"description": "Run a script to securely install Agent in Windows 2012 instance",
"mainSteps": [
{
"action":"aws:runPowerShellScript",
"name": "downloadAWSCLI",
"inputs":{
"runCommand":[
"mkdir 'C:\\Temp'\n",
"Invoke-WebRequest -Uri \"https://s3.amazonaws.com/aws-cli/AWSCLI64PY3.msi\" -OutFile 'C:\\Temp\\AWS_CLI.msi'\n",
"dir 'C:\\Temp\\'\n",
"echo 'AWS CLI is downloaded.'"
]
}
},
{
"action": "aws:applications",
"name": "installApplication",
"inputs": {
"parameters": "/quiet",
"action": "Install",
"source": "C:\\Temp\\AWS_CLI.msi"
}
},
{
"action":"aws:runPowerShellScript",
"name": "waitForAWSCLI",
"inputs":{
"runCommand":[
"while (!(Test-Path 'C:\\Program Files\\Amazon\\AWSCLI\\bin\\aws.cmd')){ Wait-Event -Timeout 10}\n",
"& 'C:\\Program Files\\Amazon\\AWSCLI\\bin\\aws.cmd'\n",
"echo 'AWS CLI is installed.'\n",
"Remove-Item -Path 'C:\\Temp\\AWS_CLI.msi'\n",
"Restart-Computer -Force"
]
}
}
]
}
DOC
}

0 comments on commit 35ecf77

Please sign in to comment.