Last active
February 19, 2022 11:18
-
-
Save MewX/972a7bfc8f7e075c4a36e70e49564ce6 to your computer and use it in GitHub Desktop.
Get oracle free arm64 instance in high demand area
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Not required after running "$ oci session authenticate". | |
provider "oci" { | |
region = "<your region>" | |
config_file_profile = "<your profile> | |
} | |
resource "oci_core_instance" "generated_oci_core_instance" { | |
agent_config { | |
is_management_disabled = "false" | |
is_monitoring_disabled = "false" | |
plugins_config { | |
desired_state = "DISABLED" | |
name = "Vulnerability Scanning" | |
} | |
plugins_config { | |
desired_state = "ENABLED" | |
name = "Compute Instance Monitoring" | |
} | |
plugins_config { | |
desired_state = "DISABLED" | |
name = "Bastion" | |
} | |
} | |
availability_config { | |
recovery_action = "RESTORE_INSTANCE" | |
} | |
availability_domain = "BlmP:<your region>" | |
compartment_id = "<your compartment id>" | |
create_vnic_details { | |
assign_private_dns_record = "false" | |
assign_public_ip = "true" | |
subnet_id = "<your subnet>" | |
} | |
display_name = "your name" | |
instance_options { | |
are_legacy_imds_endpoints_disabled = "false" | |
} | |
metadata = { | |
"ssh_authorized_keys" = "ssh-rsa <your pub key>" | |
} | |
shape = "VM.Standard.A1.Flex" | |
shape_config { | |
baseline_ocpu_utilization = "BASELINE_1_1" | |
memory_in_gbs = "24" | |
ocpus = "4" | |
} | |
source_details { | |
boot_volume_size_in_gbs = "150" | |
source_id = "<your image>" | |
source_type = "image" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
while true; do | |
echo "[mewx] Trying to apply!" | |
if terraform apply -auto-approve 2>&1 | grep 'Error Message: Out of host capacity.'; then | |
echo "[mewx] OOS issue, will try again in 15 seconds." | |
sleep 15 | |
else | |
break | |
fi | |
done | |
echo "[mewx] GOT IT!!!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment