terraform

Terraform: How to create a Kubernetes cluster on Google Cloud (GKE) with namespaces?

北慕城南 提交于 2019-12-12 20:19:54
问题 I'm after an example that would do the following: Create a Kubernetes cluster on GKE via Terraform's google_container_cluster ... and continue creating namespaces in it, I suppose via kubernetes_namespace The thing I'm not sure about is how to connect the newly created cluster and the namespace definition. For example, when adding google_container_node_pool , I can do something like cluster = "${google_container_cluster.hosting.name}" but I don't see anything similar for kubernetes_namespace

Terraform plan wants to destroy imported RDS resource

我们两清 提交于 2019-12-12 16:34:42
问题 I used the following commands to replace a previously deployed RDS instance with a manually configured RDS instance: ./terraform destroy -target aws_db_instance.my_db ./terraform import aws_db_instance.my_db my-rds-instance (Had to destroy the old instance before I could use import .) When I now run ./terraform plan , terraform wants to destroy and re-create the RDS db: -/+ aws_db_instance.my_db (new resource required) id: "my-rds-instance" => <computed> (forces new resource) address: "my-rds

Terraform REST API calls with cURL

喜你入骨 提交于 2019-12-12 13:08:37
问题 What is the best way to make REST API calls from Terraform? I'm currently using a null_resource with the local-exec provisioner to make a cURL call: resource "null_resource" "cloudability-setup" { provisioner "local-exec" { command = <<EOT curl -s -X POST https://api.cloudability.com/v3/vendors/aws/accounts \ -H 'Content-Type: application/json' \ -u "$${CldAbltyAPIToken:?Missing Cloudability API Token Env Variable}:" \ -d '{"vendorAccountId": "${data.aws_caller_identity.current.account_id}",

Terraform: Mount volume

血红的双手。 提交于 2019-12-12 08:55:19
问题 According to documentation, using terraform, I'm able to create a droplet on digital ocean: resource "digitalocean_volume" "foobar" { region = "nyc1" name = "baz" size = 100 description = "an example volume" } So, I'm also able to add a volume to it: resource "digitalocean_droplet" "foobar" { name = "baz" size = "1gb" image = "coreos-stable" region = "nyc1" volume_ids = ["${digitalocean_volume.foobar.id}"] } I'd like to know how to mount this on a desired location. I need to mount it

Sharing resources between Terraform workspaces

只愿长相守 提交于 2019-12-12 08:27:03
问题 I have an infrastructure I'm deploying using Terraform in AWS. This infrastructure can be deployed to different environments, for which I'm using workspaces. Most of the components in the deployment should be created separately for each workspace, but I have several key components that I wish to be shared between them, primarily: IAM roles and permissions They should use the same API Gateway, but each workspace should deploy to different paths and methods For example: resource "aws_iam_role"

Terraform - attach policy to s3 bucket

不想你离开。 提交于 2019-12-12 06:39:33
问题 I created an earlier post to resolve an issue for creating multiple s3 buckets without trying to duplicate code. It worked well! Terraform - creating multiple buckets The aws_iam_policy looks like so: resource "aws_iam_policy" "user_policy" { count = "${length(var.s3_bucket_name)}" name = "UserPolicy" policy = <<EOF { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "s3:PutObject", "s3:GetObject", "s3:DeleteObject", "s3:ListBucket", "s3:GetLifecycleConfiguration", "s3

terraform module depends_on Azure

你离开我真会死。 提交于 2019-12-12 01:28:34
问题 I am building a production infrastructure in Azure cloud with terraform. My requirements are below. Azure key vault should be provision first, as I will utilize a secret from there. But as terraform module doesn't support depend_on. Any workaround will be highly appricaiable. source = "./../modules/azurekeyvault/" username = "${var.username}" tags_environment = "${var.tags_environment}" } module "mysql" { source = "./../modules/mysql/" } Azure key vault module. name = "${var.lsrkeyvault}"

Why can't I create Azure VMs with Terraform Smoothly

匆匆过客 提交于 2019-12-12 00:53:35
问题 I got below error message from command prompt after around 17 minutes. Also it seems too long for execution? or is it an expected duration? azurerm_virtual_machine.vm: Still creating... (17m30s elapsed) Releasing state lock. This may take a few moments... Error: Error applying plan: 1 error(s) occurred: azurerm_virtual_machine.vm: 1 error(s) occurred: azurerm_virtual_machine.vm: unexpected EOF Terraform does not automatically rollback in the face of errors. Instead, your Terraform state file

godep save ./… seems not working for https://github.com/hashicorp/terraform

爷,独闯天下 提交于 2019-12-11 23:29:43
问题 Hi i am following the link https://github.com/hashicorp/terraform . As per given section "Adding a dependency" i have successfully run below commands git checkout master git pull godep restore -v # flag is optional, enables verbose output git checkout my-feature-branch git rebase master Now when i run godep save ./... i am getting few packages not found. if i manually update this package with go get then it looks another one and so on.. Please let me know how can i run this successfully

Using terraform modules for multiple regional api gateway

蹲街弑〆低调 提交于 2019-12-11 18:56:23
问题 I am using terraform to create aws infrastructure with 4 regional api gateways with corresponding dynamodb in that region. I want to create one module consisting of ( API + dynamo ) with configurable region specific values. Is it possible with terraform? Or I would have to create 4 separate API + 4 separate dynamodb resources. Any links or documentation would be helpful as well. Currently working for regional API gateway and corresponding dynamodb. variable "access_key" {} variable "secret