-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Nadgowda, Shripad <[email protected]>
- Loading branch information
Showing
68 changed files
with
7,769 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# NOTE: This file is for HashiCorp specific licensing automation and can be deleted after creating a new repo with this template. | ||
schema_version = 1 | ||
|
||
project { | ||
license = "MPL-2.0" | ||
copyright_year = 2021 | ||
|
||
header_ignore = [ | ||
# examples used within documentation (prose) | ||
"examples/**", | ||
|
||
# GitHub issue template configuration | ||
".github/ISSUE_TEMPLATE/*.yml", | ||
|
||
# golangci-lint tooling configuration | ||
".golangci.yml", | ||
|
||
# GoReleaser tooling configuration | ||
".goreleaser.yml", | ||
] | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
default: testacc | ||
|
||
# Run acceptance tests | ||
.PHONY: testacc | ||
testacc: | ||
TF_ACC=1 go test ./... -v $(TESTARGS) -timeout 120m |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# IDC Terraform Provider (Terraform Plugin Framework) | ||
|
||
This IDC provider plugin brings the power of Hashicorp's Terraform to Intel Developer Cloud (IDC). It allows developers to model and manage their IDC Resources through HCL IaaC (Infrastructure as a Code). | ||
|
||
## Requirements | ||
|
||
- [Terraform](https://developer.hashicorp.com/terraform/downloads) >= 1.0 | ||
- [Go](https://golang.org/doc/install) >= 1.21 | ||
|
||
## Building The Provider | ||
|
||
1. Clone the repository | ||
1. Enter the repository directory | ||
1. Build the provider using the Go `install` command: | ||
|
||
```shell | ||
go install | ||
``` | ||
|
||
## Using the provider | ||
|
||
Currently, this plugin is not published to terraform registry and is available to be used in Local Dev mode locally. | ||
|
||
## Trying out the IDC Provider | ||
|
||
If you wish to work on the provider, you'll first need [Go](http://www.golang.org) installed on your machine (see [Requirements](#requirements) above). | ||
|
||
To compile the provider, run `go install`. This will build the provider and put the provider binary in the `$GOPATH/bin` directory. | ||
|
||
For local develoment, update the terraform config to point it to the local copy of the provider plugin. | ||
|
||
Edit `~/.terraformrc` file and add following config block | ||
|
||
``` | ||
provider_installation { | ||
dev_overrides { | ||
"cloud.intel.com/services/idc" = "<$GOPATH>/bin" | ||
} | ||
# For all other providers, install them directly from their origin provider | ||
# registries as normal. If you omit this, Terraform will _only_ use | ||
# the dev_overrides block, and so no other providers will be available. | ||
direct {} | ||
} | ||
``` | ||
|
||
## IDC Login Credentials | ||
For creating resources on IDC, it requires auth credentials. More specifically, currently it requires following `two` environment variables to be configured. | ||
|
||
``` | ||
export IDC_CLOUDACCOUNT=<cloudaccount> | ||
export IDC_APITOKEN=<JWT Token > | ||
``` | ||
|
||
You can optionally, download and setup the following CLI tool to fetch it automatically. | ||
|
||
[IRR Binary Download](https://github.com/intel-innersource/applications.web.saas.optimization-registry.api/releases/tag/v0.23.5) | ||
|
||
``` | ||
response=$(irr_darwin idc login --interactive --json) | ||
IDC_CLOUDACCOUNT=$(echo $response | jq -r ".account_id") | ||
IDC_APITOKEN=$(echo $response | jq -r ".tokens.access_token") | ||
``` | ||
|
||
## Next Steps |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
--- | ||
# generated by https://github.com/hashicorp/terraform-plugin-docs | ||
page_title: "scaffolding_example Data Source - scaffolding" | ||
subcategory: "" | ||
description: |- | ||
Example data source | ||
--- | ||
|
||
# scaffolding_example (Data Source) | ||
|
||
Example data source | ||
|
||
## Example Usage | ||
|
||
```terraform | ||
data "scaffolding_example" "example" { | ||
configurable_attribute = "some-value" | ||
} | ||
``` | ||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Optional | ||
|
||
- `configurable_attribute` (String) Example configurable attribute | ||
|
||
### Read-Only | ||
|
||
- `id` (String) Example identifier |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--- | ||
# generated by https://github.com/hashicorp/terraform-plugin-docs | ||
page_title: "example function - scaffolding" | ||
subcategory: "" | ||
description: |- | ||
Example function | ||
--- | ||
|
||
# function: example | ||
|
||
Echoes given argument as result | ||
|
||
|
||
|
||
## Signature | ||
|
||
<!-- signature generated by tfplugindocs --> | ||
```text | ||
example(input string) string | ||
``` | ||
|
||
## Arguments | ||
|
||
<!-- arguments generated by tfplugindocs --> | ||
1. `input` (String) String to echo | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--- | ||
# generated by https://github.com/hashicorp/terraform-plugin-docs | ||
page_title: "scaffolding Provider" | ||
subcategory: "" | ||
description: |- | ||
--- | ||
|
||
# scaffolding Provider | ||
|
||
|
||
|
||
## Example Usage | ||
|
||
```terraform | ||
provider "scaffolding" { | ||
# example configuration here | ||
} | ||
``` | ||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Optional | ||
|
||
- `endpoint` (String) Example provider attribute |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
--- | ||
# generated by https://github.com/hashicorp/terraform-plugin-docs | ||
page_title: "scaffolding_example Resource - scaffolding" | ||
subcategory: "" | ||
description: |- | ||
Example resource | ||
--- | ||
|
||
# scaffolding_example (Resource) | ||
|
||
Example resource | ||
|
||
## Example Usage | ||
|
||
```terraform | ||
resource "scaffolding_example" "example" { | ||
configurable_attribute = "some-value" | ||
} | ||
``` | ||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Optional | ||
|
||
- `configurable_attribute` (String) Example configurable attribute | ||
- `defaulted` (String) Example configurable attribute with default value | ||
|
||
### Read-Only | ||
|
||
- `id` (String) Example identifier |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
terraform { | ||
required_providers { | ||
idc = { | ||
source = "hashicorps/idc" | ||
} | ||
} | ||
} | ||
|
||
|
||
provider "idc" { | ||
region = "us-region-1" | ||
} | ||
|
||
data "idc_machine_images" "images" { | ||
most_recent = true | ||
filters = [ | ||
{ | ||
name = "name" | ||
values = ["ubuntu-2204-jammy"] | ||
} | ||
] | ||
} | ||
|
||
# data "idc_instance_types" "insttypes" {} | ||
|
||
output "print_images" { | ||
value = data.idc_machine_images.images | ||
} | ||
|
||
# output "print_insttypes" { | ||
# value = data.idc_instance_types.insttypes | ||
# } |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#cloud-config | ||
package_update: true | ||
package_upgrade: true | ||
|
||
package: | ||
- git | ||
|
||
runcmd: | ||
- apt install ansible -y | ||
- git clone https://github.com/intel/optimized-cloud-recipes.git /tmp/optimized-cloud-recipes | ||
- cd /tmp/optimized-cloud-recipes/recipes/ai-opea-codegen-xeon | ||
- cp opea.sh /etc/profile.d/opea.sh | ||
- echo 'export HUGGINGFACEHUB_API_TOKEN=${HUGGINGFACEHUB_API_TOKEN}' | sudo tee -a /etc/profile.d/opea.sh | ||
- chmod +x /etc/profile.d/opea.sh | ||
- source /etc/profile.d/opea.sh | ||
- ansible-playbook recipe.yml |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
terraform { | ||
required_providers { | ||
idc = { | ||
source = "hashicorps/idc" | ||
} | ||
} | ||
} | ||
|
||
provider "idc" { | ||
region = var.idc_region | ||
} | ||
|
||
# data "cloudinit_config" "ansible" { | ||
# gzip = true | ||
# base64_encode = true | ||
|
||
# part { | ||
# filename = "cloud_init" | ||
# content_type = "text/cloud-config" | ||
# content = templatefile( | ||
# "cloud_init.yml", | ||
# { | ||
# HUGGINGFACEHUB_API_TOKEN=var.huggingface_token | ||
# } | ||
# ) | ||
# } | ||
# } | ||
|
||
# resource "idc_sshkey" "example" { | ||
# metadata = { | ||
# name = var.ssh_key_name | ||
# } | ||
# spec = { | ||
# ssh_public_key = file(var.ssh_pubkey_path) | ||
# owner_email = var.ssh_user_email | ||
# } | ||
# } | ||
|
||
resource "idc_instance" "example" { | ||
name = var.instance_name | ||
spec = { | ||
instance_type = var.instance_types[var.instance_type] | ||
machine_image = var.os_image | ||
ssh_public_key_names = [var.ssh_key_name] | ||
user_data = file("./cloud_init.yaml") | ||
} | ||
# depends_on = [idc_sshkey.example] | ||
} | ||
|
||
output "instance_order" { | ||
value = idc_instance.example | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
idc_region = "us-staging-1" | ||
ssh_key_name = "shrimac" | ||
instance_name = "genai-chatqna-demo3" | ||
ssh_pubkey_path = "/Users/snadgowd/.ssh/id_ed25519.pub" | ||
ssh_user_email = "[email protected]" | ||
instance_type = "vm-large" | ||
filesystem_name = "shri-fs6" | ||
filesystem_size_in_tb = 1 |
Oops, something went wrong.