Skip to content

Instantly share code, notes, and snippets.

View jjruescas's full-sized avatar

JJ Ruescas jjruescas

  • Austin, Texas
View GitHub Profile
## Clueless about what your Powershell DSC Configuration is doing? No problem! You can find the log files in json format in this location:
## This is especially useful when you configure Reboots and there are DSC Resources that depend on that reboot. The log file will display what happened during the whole execution of the configuration pre and post-reboot
C:\Windows\System32\Configuration\ConfigurationStatus
#Troubleshooting Microsoft Link
# https://docs.microsoft.com/en-us/powershell/scripting/dsc/troubleshooting/troubleshooting?view=powershell-7
data "http" "myip" {
url = "http://ipv4.icanhazip.com"
}
resource "aws_security_group_rule" "ingress_with_cidr_blocks" {
...
ingress {
from_port = 5432
to_port = 5432
protocol = "tcp"
@jjruescas
jjruescas / install_choco_and_packages.ps1
Last active December 12, 2022 15:52
Simple Terraform example that provisions a Linux 2 EC2 Instance and installs Nginx on it.
#Install Chocolatey
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
#Install Packages
choco install terraform -y
choco install awscli -y
#Refresh Environment Variables
$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine")
rackspace-public output will be in this color.
==> rackspace-public: Loading flavor: 8
rackspace-public: Verified flavor. ID: 8
==> rackspace-public: Pausing after run of step 'StepLoadFlavor'. Press enter to continue.
==> rackspace-public: Creating temporary keypair: packer_5b315e41-1c18-ff98-a141-d1c6ed53371a ...
==> rackspace-public: Created temporary keypair: packer_5b315e41-1c18-ff98-a141-d1c6ed53371a
==> rackspace-public: Successfully converted BER encoded SSH key to DER encoding.
rackspace-public: Saving key for debug purposes: os_rackspace-public.pem
==> rackspace-public: Pausing after run of step 'StepKeyPair'. Press enter to continue.
<powershell>
write-output "Running User Data Script"
write-host "(host) Running User Data Script"
Set-ExecutionPolicy Unrestricted -Scope LocalMachine -Force -ErrorAction Ignore
# Don't set this before Set-ExecutionPolicy as it throws an error
$ErrorActionPreference = "stop"
{
"builders": [{
"type": "openstack",
"name": "rackspace-public",
"region": "DFW",
"username": "USERNAME",
"password": "PASSWORD",
"openstack_provider": "rackspace",
"identity_endpoint": "https://identity.api.rackspacecloud.com/v2.0",