Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix terrafrom config bug #14362

Merged
merged 3 commits into from
Jul 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not keep hcl?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keep hcl is ok to me, but we execute this command into the shell instead of terrafrom. so I change to shell.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so, do you prefer to use hcl or shell, all look go for me

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, both is okay on me, either.

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