Skip to content
This repository has been archived by the owner on Jan 25, 2023. It is now read-only.

How to override instance_role when using consul-cluster module? #231

Open
lenew opened this issue Jun 28, 2021 · 1 comment
Open

How to override instance_role when using consul-cluster module? #231

lenew opened this issue Jun 28, 2021 · 1 comment

Comments

@lenew
Copy link

lenew commented Jun 28, 2021

In cn-north-1 region, It should be "ec2.amazonaws.com.cn" instead of "ec2.amazonaws.com" at aws_iam_policy_document.
Currently, I modify .terraform/modules/consul_cluster/modules/consul-cluster/main.tf before apply it. Is there a better way to override this value?
My code

module "consul_cluster" {
  # TODO: update this to the final URL
  # Use version v0.0.5 of the consul-cluster module
  source = "github.com/hashicorp/terraform-aws-consul//modules/consul-cluster?ref=v0.10.1"

  # Specify the ID of the Consul AMI. You should build this using the scripts in the install-consul module.
  ami_id = "ami-abc"

  # Add this tag to each node in the cluster
  cluster_tag_key   = "consul-cluster"
  cluster_tag_value = "consul-example"

  # Configure and start Consul during boot. It will automatically form a cluster with all nodes that have that same tag.
  user_data = <<-EOF
              #!/bin/bash
              /opt/consul/bin/run-consul --server --cluster-tag-key consul-cluster --cluster-tag-value consul-example
              EOF

  # region = "cn-north-1"
  cluster_name = "my-consul"
  instance_type = "t3.micro"
  vpc_id = "vpc-23e3fd40"
  subnet_ids = ["subnet-dfe6ffad", "subnet-8c143df9"]
  allowed_inbound_cidr_blocks = ["172.31.0.0/16"]
}
@brikis98
Copy link
Collaborator

Ah, this should probably be exposed as an input variable that defaults to ec2.amazonaws.com but can be overridden. PR welcome!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants