Commit Graph

795 Commits

Author SHA1 Message Date
The Magician
43cccf3e2c Minor cleanup of disk's labelFingerprint. (#1651) 2018-06-14 20:34:10 -05:00
Dana Hoffman
d884312f88
don't error if service account key is already gone on delete (#1659)
Fixes #1657
2018-06-14 14:49:24 -07:00
The Magician
f4e4d880c5 Autogenerate Route resource. (#1647) 2018-06-14 15:22:02 -05:00
Daisuke Fujita
b7f2025fb9 Add project to container_node_pool import name (#1653)
## What

As well as https://github.com/terraform-providers/terraform-provider-google/pull/1282 , make `resource_container_node_pool` importer accept `{project}/{zone}/{cluster}/{name}` format to specify the project where the node pool belongs to actually.

## Why

Sometimes I want to import container pool in different project from default SA's. However, currently there is no way to specify project the target node pool belongs to, Terraform tries to retrieve node pool from SA's project, then it fails due to `You cannot import non-existent resources using Terraform import.` error.
2018-06-14 09:54:08 -07:00
Dana Hoffman
d424cf05ba
fix iot updatemask and docs (#1640) 2018-06-13 12:37:21 -07:00
Dana Hoffman
0497eec580
use same mutex for project_iam_policy as the other project_iam resources (#1645) 2018-06-13 12:35:49 -07:00
The Magician
d4b4436feb Store address region as short name instead of full URL. Fixes currently failing test TestAccComputeVpnTunnel_defaultTrafficSelectors. (#1646)
<!-- This change is generated by MagicModules. -->
/cc @danawillow
2018-06-13 11:35:04 -07:00
The Magician
50f00fa6dc Autogenerate the Address resource. (#1634) 2018-06-11 17:31:33 -07:00
Dana Hoffman
f0c5b34a1d
add error checking for bigquery dataset id (#1638)
* add error checking for bigquery dataset id

* use existing regexes for import validation
2018-06-11 14:20:11 -07:00
The Magician
605c950b18 Add DiffSuppress for global address ip_version. IPV4 and empty are equivalent, but the API will return whichever one was sent on creation. Fixes #1637. (#1639) 2018-06-11 14:17:04 -07:00
Dana Hoffman
13eba21650
update sql user docs/comments (#1635) 2018-06-11 13:47:01 -07:00
Paddy
430b735dd0
Merge pull request #1621 from terraform-providers/paddy_app_engine_app
Make App Engine applications updatable
2018-06-11 13:09:50 -07:00
Paddy
8f9d0785f2
Merge pull request #1622 from terraform-providers/paddy_undeprecate_ssl_name_prefix
Undeprecate name_prefix for ssl_certificate.
2018-06-11 13:09:08 -07:00
Dana Hoffman
c505255556
changes to make it easier to autogen address (#1607) 2018-06-08 16:35:36 -07:00
The Magician
877f8107f8 Check for done redis operations before waiting on them. Fixes #1630. (#1633) 2018-06-08 16:32:24 -07:00
Dana Hoffman
d00e55f11b
check for done operations before waiting on them (#1632) 2018-06-08 16:04:55 -07:00
The Magician
d7d72398b6 zone field in compute disk should be optional (#1631) 2018-06-08 15:20:39 -07:00
Vincent Roseberry
4f89945cce
Store v1 self_link for network and subnetwork (#1629) 2018-06-08 09:55:21 -07:00
Olve S. Hansen
d605e0f170 Fixes #1624 - issues with consecutive whitespace. (#1625) 2018-06-08 09:37:29 -07:00
Vincent Roseberry
32d965062d
Support update for DNS Managed Zone (#1617)
* vendor google.golang.org/api/dns/v1beta2

* Support update for DNS Managed Zone
2018-06-08 09:27:08 -07:00
Paddy
470f27b659 Undeprecate name_prefix for ssl_certificate.
As discussed in #1326, we're not going to remove name_prefix for
compute_ssl_certificate, because it makes the common use case more
ergonomic by a good amount, and the only cost is it's harder to maintain
the autogenerated code, and we've decided the benefits outweigh the
costs in this circumstance.
2018-06-07 18:29:45 -07:00
Paddy
8296c16168 Remove extraneous Exists checks in App Engine tests. 2018-06-07 18:16:48 -07:00
Paddy
4176a98949 terraform fmt all configs in project_test. 2018-06-07 18:14:43 -07:00
Paddy
6910d8277e SetPartial on app_engine. 2018-06-07 18:11:07 -07:00
Paddy
4999637399 Remove unnecessary CustomizeDiff function. 2018-06-07 18:09:51 -07:00
Paddy
16ab5bb14b Reorder fields. 2018-06-07 18:09:14 -07:00
Paddy Carver
6d040db9d8 Really fix location_id force new. 2018-06-07 15:37:30 -07:00
Sébastien GLON
d766990ce9 Add new google_compute_regions (#1603)
* Add new google_compute_regions

* Add docs

* correct doc
2018-06-07 09:52:12 -07:00
Dana Hoffman
e92fddd33e
Fix forwarding rule data source test (#1606) 2018-06-06 18:40:42 -07:00
The Magician
edb34aaaf7 Fix redis authorized network and tests. The Redis API currently only accepts partial links. The tests weren't failing because they weren't actually using the network (oops). There were a few other test issues that I fixed while I was there. Fixes #1571. (#1599)
<!-- This change is generated by MagicModules. -->
/cc @danawillow
2018-06-06 10:55:04 -07:00
Paddy Carver
53cc357b4c Fix network_tier tests.
Make network_tier computed, so when it's not specified we don't get a
permadiff.

Always store v1 self_links, so we don't get a permadiff.
2018-06-05 17:49:33 -07:00
Paddy Carver
9ebeeda1d2 Fix forcenew for location_id. 2018-06-05 15:31:52 -07:00
Dana Hoffman
2f5c77cd7f add support for network tiers (#1530)
* add support for network tiers

* Update resource_compute_forwarding_rule.go
2018-06-05 12:35:44 -07:00
Jamie Lennox
f8eb752809 Allow using in repo configuration for cloudbuild trigger (#1557)
* Allow using in repo configuration for cloudbuild trigger

Cloudbuild triggers have a complex configuration that can be defined
from the API. When using the console, the more typical way of doing this
is to defined the configuration within the repository and point the
configuration to the file that defines the config.

This can be supported by sending the filename parameter instead of the
build parameter, however only one can be sent.

* Acceptance testing for cloudbuild trigger with filename

Ensure that when a cloudbuild repo trigger is created with a filename,
that filename is what actually ends up in the cloud.

* Don't specify "by default" in cloudbuild-trigger.

The docs shouldn't say that "cloudbuild.yaml" is used by default. There
is no default from the APIs, but the console suggest using this value.
Just say it's the typical value in documentation.
2018-06-05 10:17:20 -07:00
The Magician
164936e4a5 add update support for redis (#1590)
* add update support for redis

* add test for redis update
2018-06-04 17:41:48 -07:00
Tenorio Orta JM
6864f1f9e5 Added GCP Netblock Data Source (#1416) (#1580)
* Added GCP Netblock Data Source (#1416)

* Added docs for google_netblock_ip_ranges (#1416)

* Code review changes (#1416)
2018-06-04 16:31:09 -07:00
Mikaël Gibert
d60381a693 Implement multiple version in instance group manager (#1499)
Hi there,

Here is an attempt to implement canary releases ( #1252 ). This is the first time I write golang and make a terraform contribution, I opened the PR to obtain feedback and advices so please let me know how I can improve this code!

In addition I used `make fmt` to format the code but left some lines bigger than 80 characters, do I need to split them ?

I tested the feature against a project with the following configuration:
```
resource "google_compute_health_check" "mikael-hackathon-healthcheck" {
  name                = "mikael-hackathon-healthcheck"
  check_interval_sec  = 1
  timeout_sec         = 1
  healthy_threshold   = 2
  unhealthy_threshold = 10

  http_health_check {
    request_path = "/"
    port         = "80"
  }
}

resource "google_compute_instance_template" "mikael-hackaton-template" {
  name_prefix = "mikael-hackaton-"
  description = "This template is used to create app server instances."

  tags = ["loadbalanced", "internal-web", "hackaton"]

  labels = {
    environment = "hackaton"
  }

  instance_description = "Hackaton demo rolling upgrade"
  machine_type         = "n1-standard-1"
  can_ip_forward       = false

  scheduling {
    automatic_restart   = true
    on_host_maintenance = "MIGRATE"
  }

  disk {
    source_image = "debian-cloud/debian-9"
    disk_type    = "pd-standard"
    disk_size_gb = 20
    auto_delete  = true
    boot         = true
  }

  network_interface {
    network       = "default"
    access_config = {}
  }

  service_account {
    email  = "${google_service_account.mikael-hackaton.email}"
    scopes = ["cloud-platform"]
  }

  lifecycle {
    create_before_destroy = true
  }

  metadata_startup_script = "apt-get update && apt-get install -y apache2 && echo I am stable version at $(hostname) > /var/www/html/index.html"
}

resource "google_compute_instance_template" "mikael-hackaton-template-canary" {
  name_prefix = "mikael-hackaton-canary"
  description = "This template is used to create app server instances."

  tags = ["loadbalanced", "internal-web", "hackaton"]

  labels = {
    environment = "hackaton"
  }

  instance_description = "Hackaton demo rolling upgrade"
  machine_type         = "n1-standard-1"
  can_ip_forward       = false

  scheduling {
    automatic_restart   = true
    on_host_maintenance = "MIGRATE"
  }

  disk {
    source_image = "debian-cloud/debian-9"
    disk_type    = "pd-standard"
    disk_size_gb = 20
    auto_delete  = true
    boot         = true
  }

  network_interface {
    network       = "default"
    access_config = {}
  }

  service_account {
    email  = "${google_service_account.mikael-hackaton.email}"
    scopes = ["cloud-platform"]
  }

  lifecycle {
    create_before_destroy = true
  }

  metadata_startup_script = "apt-get update && apt-get install -y apache2 && echo I am a canary at $(hostname) > /var/www/html/index.html"
}

resource "google_compute_target_pool" "mikael-hackaton-target-pool" {
  name = "mikael-hackaton-target-pool"
}

resource "google_compute_instance_group_manager" "mikael-hackaton-manager" {
  name = "mikael-hackaton-manager"
  base_instance_name = "mikael-hackaton"
  #instance_template = "${google_compute_instance_template.mikael-hackaton-template.self_link}"
  update_strategy   = "ROLLING_UPDATE"
  zone              = "${var.zone}"
  target_pools = ["${google_compute_target_pool.mikael-hackaton-target-pool.self_link}"]
  target_size  = 5

  version {
    name = "primary"
    instance_template = "${google_compute_instance_template.mikael-hackaton-template.self_link}"
  }

  version {
    name = "canary"
    instance_template = "${google_compute_instance_template.mikael-hackaton-template-canary.self_link}"
    target_size_fixed = 1
  }

  named_port {
    name = "http"
    port = 80
  }

  auto_healing_policies {
    health_check      = "${google_compute_health_check.mikael-hackathon-healthcheck.self_link}"
    initial_delay_sec = 10
  }

  rolling_update_policy {
    type                    = "PROACTIVE"
    minimal_action          = "REPLACE"
    max_surge_percent       = 100
    max_unavailable_percent = 50
    min_ready_sec           = 5
  }
}
```
2018-06-04 15:34:48 -07:00
Dana Hoffman
ac6e30d335
allow beta kubernetes logging; add monitoring validation (#1589)
Fixes #1577
2018-06-04 15:09:52 -07:00
The Magician
b85473619c Correct issue with Disk encryption. (#1584)
* Correct issue with Disk encryption.

* Update to test to make it less permissive.
2018-06-04 10:01:52 -07:00
The Magician
dd92a3732e Adds handleNotFoundError to all resource's Delete methods. (#1581) 2018-06-02 17:33:30 -03:00
The Magician
fd208dc7ca Autogenerate Disk resource (#1521). 2018-05-31 18:10:06 -07:00
Jonathan Pentecost
8f31fec857 New datasource: service account and service account key (#1535) 2018-05-31 17:31:45 -07:00
Seth Vargo
aff6bc6519 Retry while listing enabled services (#1573)
This fixes GH-1562 for realz
2018-05-31 14:50:38 -07:00
Paddy Carver
d0a6b2b5b5 Make App Engine applications updatable.
No longer ForceNew when adding an App Engine application to a project,
when modifying the auth domain, modifying the serving status, or
modifying the feature settings.
2018-05-31 14:26:24 -07:00
Seth Vargo
40094ba417 Lions, tigers, and services being enabled with "precondition failed", oh my! (#1565)
* Use errwrap to retain original error

* Use built-in Page function, only return names when listing services

This removes the custom logic on pagination and uses the built-in Page function in the SDK to make things a bit simpler. Additionally, I added a field filter to only return service names, which drastically reduces the size of the API call (important for slow connections, given how frequently this function is executed).

Also added errwrap to better trace where errors originate.

* Add helper function for diffing string slices

This just looked really nasty inline

* Batch 20 services at a time, handle precondition failed, better errwrap

This commit does three things:

1. It batches services to be enabled 20 at a time. The API fails if you try to enable more than 20 services, and this is documented in the SDK and API. I learned this the hard way. I think Terraform should "do the right thing" here and batch them in series' of twenty, which is what this does. Each batch is tried in serial, but I think making it parallelized is not worth the complexity tradeoffs.

2. Handle the precondition failed error that occurs randomly. This just started happened, but it affects at least two APIs consistently, and a rudimentary test showed that it failed 78% of the time (78/100 times in an hour). We should fix this upstream, but that failure rate also necessitates (in my opinion) some mitigation on the Terraform side until a fix is in place at the API level.

3. Use errwrap on errors for better tracing. It was really difficult to trace exactly which error was being throw. That's fixed.

* Updates from code review
2018-05-31 09:26:40 -07:00
The Magician
6240cf2ab4 Add support for SSL policy to google_compute_target_ssl_proxy (#1568) 2018-05-30 16:00:53 -07:00
Tenorio Orta JM
8a77e42698 Added support for restoring default organization policies (#1477)
* Added support for restoring default organization policies

* Added support for restoring default folder/project organization policies

* Refactored code

* Fixes #1239

* Clarify docs

* Clarify docs

* Clarify docs
2018-05-30 15:48:08 -07:00
Tenorio Orta JM
c6b0cfcbfa Added user label support in sql_database_instance (#1372) (#1567)
* Added user label support in sql_database_instance (#1372)

* Fixes #1372
2018-05-30 15:32:11 -07:00
Vincent Roseberry
ebbae91b77
Convert instance_group self_link to v1 (#1549) 2018-05-30 15:25:07 -07:00
Ian L
b4be2fa124 Add basic update for google_kms_crypto_key resource (#1511)
* Add basic update for `google_kms_crypto_key` resource

Prior to this commit, any changes to `rotation_period` would
force a new resource as no `Update` was defined for the resource.
This commit introduces a basic `Update` through calling the
`Patch` service method. It only modifies the `rotation_period`,
and `next_rotation_time` at the moment, but this is reflective
of what is "allowed" on https://console.cloud.google.com/security/kms.

* Remove unused `Purpose` value in `CryptoKey`

We are only patching the `rotation_period`, and `next_rotation_time`,
so that value will not be affected.

* nit: format `Patch` operation to be in a single line

* Extend `TestAccKmsCryptoKey_rotation` test steps

- Test change in rotation period
- Test removal of rotation period

* Do not parse `NextRotationTime` if it is not set

* remove ForceNew: false
2018-05-29 17:20:32 -07:00