generated from AgnostiqHQ/covalent-executor-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixing docker image and adding tf files (#75)
* added terraform files * changed name variable * removed unneeded pip installations in the docker image * fixed docker image pip installation * updated changelog
- Loading branch information
1 parent
3f708bf
commit 9cb1fa4
Showing
8 changed files
with
164 additions
and
1 deletion.
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
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
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
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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
include VERSION | ||
include requirements.txt | ||
recursive-include covalent_braket_plugin/assets/infra/ * |
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,59 @@ | ||
# Copyright 2023 Agnostiq Inc. | ||
# | ||
# This file is part of Covalent. | ||
# | ||
# Licensed under the Apache License 2.0 (the "License"). A copy of the | ||
# License may be obtained with this software package or at | ||
# | ||
# https://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Use of this file is prohibited except in compliance with the License. | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
provider "aws" { | ||
region = var.aws_region | ||
} | ||
|
||
data "aws_caller_identity" "current" {} | ||
|
||
# The bucket name needs amazon-braket prefix to be able to use the braket service. | ||
resource "aws_s3_bucket" "braket_bucket" { | ||
bucket = "amazon-braket-${var.name}-bucket" | ||
force_destroy = true | ||
} | ||
|
||
resource "aws_ecr_repository" "braket_ecr_repo" { | ||
name = "${var.name}-base-executor-repo" | ||
image_tag_mutability = "MUTABLE" | ||
|
||
force_delete = true | ||
image_scanning_configuration { | ||
scan_on_push = false | ||
} | ||
|
||
provisioner "local-exec" { | ||
command = "docker pull public.ecr.aws/covalent/covalent-braket-executor:${var.executor_base_image_tag_name} && aws ecr get-login-password --region ${var.aws_region} | docker login --username AWS --password-stdin ${data.aws_caller_identity.current.account_id}.dkr.ecr.${var.aws_region}.amazonaws.com && docker tag public.ecr.aws/covalent/covalent-braket-executor:${var.executor_base_image_tag_name} ${aws_ecr_repository.braket_ecr_repo.repository_url}:${var.executor_base_image_tag_name} && docker push ${aws_ecr_repository.braket_ecr_repo.repository_url}:${var.executor_base_image_tag_name}" | ||
} | ||
} | ||
|
||
resource "aws_iam_role" "braket_iam_role" { | ||
name = "${var.name}-role" | ||
assume_role_policy = jsonencode({ | ||
Version = "2012-10-17" | ||
Statement = [ | ||
{ | ||
Action = "sts:AssumeRole" | ||
Effect = "Allow" | ||
Sid = "" | ||
Principal = { | ||
Service = "braket.amazonaws.com" | ||
} | ||
}, | ||
] | ||
}) | ||
managed_policy_arns = ["arn:aws:iam::aws:policy/AmazonBraketFullAccess"] | ||
} |
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 @@ | ||
# Copyright 2023 Agnostiq Inc. | ||
# | ||
# This file is part of Covalent. | ||
# | ||
# Licensed under the Apache License 2.0 (the "License"). A copy of the | ||
# License may be obtained with this software package or at | ||
# | ||
# https://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Use of this file is prohibited except in compliance with the License. | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
output "braket_job_execution_role_name" { | ||
value = aws_iam_role.braket_iam_role.id | ||
description = "Allocated IAM role name" | ||
} | ||
|
||
output "s3_bucket_name" { | ||
value = aws_s3_bucket.braket_bucket.id | ||
description = "Allocated AWS S3 bucket name for storing lambda files" | ||
} | ||
|
||
output "ecr_image_uri" { | ||
value = "${aws_ecr_repository.braket_ecr_repo.repository_url}:${var.executor_base_image_tag_name}" | ||
description = "Allocated ECR repo name" | ||
} |
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 @@ | ||
# Copyright 2023 Agnostiq Inc. | ||
# | ||
# This file is part of Covalent. | ||
# | ||
# Licensed under the Apache License 2.0 (the "License"). A copy of the | ||
# License may be obtained with this software package or at | ||
# | ||
# https://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Use of this file is prohibited except in compliance with the License. | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
# Prefix this "name" with something unique for your deployment | ||
variable "name" { | ||
default = "covalent-braket" | ||
description = "Name to be used in the new provisioned resources" | ||
} | ||
|
||
variable "aws_region" { | ||
default = "us-east-1" | ||
description = "AWS region in which to run Braket" | ||
} | ||
|
||
variable "executor_base_image_tag_name" { | ||
default = "latest" | ||
description = "The tag name associate base executor image that is pushed to the provisioned private ecr repo" | ||
} |
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,24 @@ | ||
# Copyright 2023 Agnostiq Inc. | ||
# | ||
# This file is part of Covalent. | ||
# | ||
# Licensed under the Apache License 2.0 (the "License"). A copy of the | ||
# License may be obtained with this software package or at | ||
# | ||
# https://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Use of this file is prohibited except in compliance with the License. | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
terraform { | ||
required_providers { | ||
aws = { | ||
source = "hashicorp/aws" | ||
version = "~> 5.17" | ||
} | ||
} | ||
} |