Skip to content

Commit

Permalink
fix terrafrom config bug (#14362)
Browse files Browse the repository at this point in the history
(cherry picked from commit b5d88f2)
  • Loading branch information
zhongjiajie committed Jul 20, 2023
1 parent 2856b67 commit 946d173
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 49 deletions.
73 changes: 32 additions & 41 deletions deploy/terraform/aws/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions deploy/terraform/aws/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

Set necessary variables by creating a file `ds-ami.pkrvars.hcl` and adding the following variables according to your own usage.

```hcl
```shel
cat <<EOF > ds-ami.pkrvars.hcl
aws_access_key = ""
aws_secret_key = ""
Expand All @@ -17,7 +17,7 @@ aws_region = "cn-north-1"
ds_ami_name = "my-test-ds-2"
# If you want to use the official distribution tar, just set the `ds_version` to the one you want.
ds_version = 3.1.1
ds_version = "3.1.1"
# If you want to use a locally built distribution tar, set the `ds_tar` to the tar file location.
ds_tar = "~/workspace/dolphinscheduler/dolphinscheduler-dist/target/apache-dolphinscheduler-3.1.3-SNAPSHOT-bin.tar.gz"
Expand Down Expand Up @@ -50,6 +50,7 @@ Make sure `ds_ami_name` is the same as the one in `ds-ami.pkrvars.hcl` above.
cat <<EOF > terraform.tfvars
aws_access_key = ""
aws_secret_key = ""
aws_region = ""
name_prefix = "test-ds-terraform"
ds_ami_name = "my-test-ds"
Expand Down
1 change: 1 addition & 0 deletions deploy/terraform/aws/dolphinscheduler-worker.tf
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ data "template_file" "worker_user_data" {
"database_username" = aws_db_instance.database.username
"database_password" = aws_db_instance.database.password
"zookeeper_connect_string" = var.zookeeper_connect_string != "" ? var.zookeeper_connect_string : aws_instance.zookeeper[0].private_ip
"alert_server_host" = ""
"s3_access_key_id" = aws_iam_access_key.s3.id
"s3_secret_access_key" = aws_iam_access_key.s3.secret
"s3_region" = var.aws_region
Expand Down
12 changes: 7 additions & 5 deletions deploy/terraform/aws/s3-main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@ module "s3_bucket" {
source = "terraform-aws-modules/s3-bucket/aws"
version = "~> 3.6"

bucket_prefix = var.s3_bucket_prefix
acl = "private"
force_destroy = true
attach_policy = true
policy = data.aws_iam_policy_document.s3.json
bucket_prefix = var.s3_bucket_prefix
acl = "private"
control_object_ownership = true
object_ownership = "ObjectWriter"
force_destroy = true
attach_policy = true
policy = data.aws_iam_policy_document.s3.json
}

resource "aws_iam_user" "s3" {
Expand Down
3 changes: 2 additions & 1 deletion deploy/terraform/aws/zookeeper-main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ resource "aws_instance" "zookeeper" {
vpc_security_group_ids = [aws_security_group.zookeeper_sg[count.index].id]
source_dest_check = false
associate_public_ip_address = var.vm_associate_public_ip_address.standalone_server
key_name = aws_key_pair.key_pair.key_name

user_data = data.template_file.zookeeper_user_data.rendered

Expand All @@ -94,7 +95,7 @@ resource "aws_instance" "zookeeper" {

connection {
type = "ssh"
user = "root"
user = "ec2-user"
private_key = tls_private_key.key_pair.private_key_pem
host = self.public_ip
timeout = "30s"
Expand Down

0 comments on commit 946d173

Please sign in to comment.