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

mark removed fields as computed #2910

Merged
merged 2 commits into from
Jan 6, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 1 addition & 0 deletions templates/terraform/extra_schema_entry/alert_policy.erb
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@
Type: schema.TypeString,
},
Removed: "labels is removed as it was never used. See user_labels for the correct field",
Computed: true,
},
7 changes: 4 additions & 3 deletions templates/terraform/extra_schema_entry/forwarding_rule.erb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
# limitations under the License.
-%>
"ip_version": {
Type: schema.TypeString,
Optional: true,
Removed: "ipVersion is not used for regional forwarding rules. Please remove this field if you are using it.",
Type: schema.TypeString,
Optional: true,
Removed: "ipVersion is not used for regional forwarding rules. Please remove this field if you are using it.",
Computed: true,
},
Original file line number Diff line number Diff line change
Expand Up @@ -13,40 +13,47 @@
# limitations under the License.
-%>
"is_internal": {
Type: schema.TypeBool,
Optional: true,
Removed: "This field never worked, and will be removed in 3.0.0.",
Type: schema.TypeBool,
Optional: true,
Removed: "This field never worked, and will be removed in 3.0.0.",
Computed: true,
},
"internal_checkers": {
Type: schema.TypeList,
Optional: true,
Removed: "This field never worked, and will be removed in 3.0.0.",
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"display_name": {
Type: schema.TypeString,
Optional: true,
Removed: "This field never worked, and will be removed in 3.0.0.",
Computed: true,
},
"gcp_zone": {
Type: schema.TypeString,
Optional: true,
Removed: "This field never worked, and will be removed in 3.0.0.",
Computed: true,
},
"name": {
Type: schema.TypeString,
Optional: true,
Removed: "This field never worked, and will be removed in 3.0.0.",
Computed: true,
},
"network": {
Type: schema.TypeString,
Optional: true,
Removed: "This field never worked, and will be removed in 3.0.0.",
Computed: true,
},
"peer_project_id": {
Type: schema.TypeString,
Optional: true,
Removed: "This field never worked, and will be removed in 3.0.0.",
Computed: true,
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,16 @@ func dataSourceGoogleContainerEngineVersions() *schema.Resource {
Optional: true,
},
"zone": {
Type: schema.TypeString,
Optional: true,
Removed: "Use location instead",
Type: schema.TypeString,
Optional: true,
Removed: "Use location instead",
Computed: true,
},
"region": {
Type: schema.TypeString,
Optional: true,
Removed: "Use location instead",
Type: schema.TypeString,
Optional: true,
Removed: "Use location instead",
Computed: true,
},
"default_cluster_version": {
Type: schema.TypeString,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,10 @@ func resourceComputeInstanceGroupManager() *schema.Resource {
},

"instance_template": {
Type: schema.TypeString,
Optional: true,
Computed: true,
Removed: "This field has been replaced by `version.instance_template`",
DiffSuppressFunc: compareSelfLinkRelativePaths,
Type: schema.TypeString,
Optional: true,
Computed: true,
Removed: "This field has been replaced by `version.instance_template`",
},

"version": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@ func resourceComputeNetworkPeering() *schema.Resource {
},

"auto_create_routes": {
Type: schema.TypeBool,
Optional: true,
Removed: "auto_create_routes has been removed because it's redundant and not user-configurable. It can safely be removed from your config",
ForceNew: true,
Type: schema.TypeBool,
Optional: true,
Removed: "auto_create_routes has been removed because it's redundant and not user-configurable. It can safely be removed from your config",
Computed: true,
},
},
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ func resourceComputeRegionInstanceGroupManager() *schema.Resource {
Type: schema.TypeString,
Removed: "This field is removed.",
Optional: true,
Computed: true,
},

"target_pools": {
Expand Down
26 changes: 16 additions & 10 deletions third_party/terraform/resources/resource_container_cluster.go.erb
Original file line number Diff line number Diff line change
Expand Up @@ -150,15 +150,17 @@ func resourceContainerCluster() *schema.Resource {
},

"region": {
Type: schema.TypeString,
Optional: true,
Removed: "Use location instead",
Type: schema.TypeString,
Optional: true,
Removed: "Use location instead",
Computed: true,
},

"zone": {
Type: schema.TypeString,
Optional: true,
Removed: "Use location instead",
Type: schema.TypeString,
Optional: true,
Removed: "Use location instead",
Computed: true,
},

"node_locations": {
Expand All @@ -169,10 +171,11 @@ func resourceContainerCluster() *schema.Resource {
},

"additional_zones": {
Type: schema.TypeSet,
Optional: true,
Removed: "Use node_locations instead",
Elem: &schema.Schema{Type: schema.TypeString},
Type: schema.TypeSet,
Optional: true,
Removed: "Use node_locations instead",
Computed: true,
Elem: &schema.Schema{Type: schema.TypeString},
},

"addons_config": {
Expand Down Expand Up @@ -216,6 +219,7 @@ func resourceContainerCluster() *schema.Resource {
Type: schema.TypeList,
Optional: true,
Removed: "The Kubernetes Dashboard addon is removed for clusters on GKE.",
Computed: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
Expand Down Expand Up @@ -640,6 +644,7 @@ func resourceContainerCluster() *schema.Resource {
<% if version == 'ga' -%>
// Remove return nil from expand when this is removed for good.
Removed: "This field is in beta. Use it in the the google-beta provider instead. See https://terraform.io/docs/providers/google/guides/provider_versions.html for more details.",
Computed: true,
<% else -%>
DiffSuppressFunc: podSecurityPolicyCfgSuppress,
<% end -%>
Expand Down Expand Up @@ -940,6 +945,7 @@ func resourceContainerCluster() *schema.Resource {
Optional: true,
<% if version == 'ga' -%>
Removed: "This field is in beta. Use it in the the google-beta provider instead. See https://terraform.io/docs/providers/google/guides/provider_versions.html for more details.",
Computed: true,
<% else -%>
Default: false,
<% end -%>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,16 @@ func resourceContainerNodePool() *schema.Resource {
ForceNew: true,
},
"zone": {
Type: schema.TypeString,
Optional: true,
Removed: "use location instead",
Type: schema.TypeString,
Optional: true,
Removed: "use location instead",
Computed: true,
},
"region": {
Type: schema.TypeString,
Optional: true,
Removed: "use location instead",
Type: schema.TypeString,
Optional: true,
Removed: "use location instead",
Computed: true,
},
"location": {
Type: schema.TypeString,
Expand Down Expand Up @@ -442,7 +444,7 @@ func resourceContainerNodePoolStateImporter(d *schema.ResourceData, meta interfa

id, err := replaceVars(d, config, "projects/{{project}}/locations/{{location}}/clusters/{{cluster}}/nodePools/{{name}}")
if err != nil {
return nil, err
return nil, err
}
d.SetId(id)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ func resourceGoogleServiceAccountKey() *schema.Resource {
"pgp_key": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Removed: "The pgp_key field has been removed. See https://www.terraform.io/docs/extend/best-practices/sensitive-state.html for more information.",
Computed: true,
},
"private_key_type": {
Type: schema.TypeString,
Expand Down
1 change: 1 addition & 0 deletions third_party/terraform/resources/resource_storage_bucket.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ func resourceStorageBucket() *schema.Resource {
Type: schema.TypeBool,
Optional: true,
Removed: "Please use `with_state` instead",
Computed: true,
},
"with_state": {
Type: schema.TypeString,
Expand Down
2 changes: 2 additions & 0 deletions third_party/terraform/utils/node_config.go.erb
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ var schemaNodeConfig = &schema.Schema{
"workload_metadata_config": {
<% if version.nil? || version == 'ga' -%>
Removed: "This field is in beta. Use it in the the google-beta provider instead. See https://terraform.io/docs/providers/google/guides/provider_versions.html for more details.",
Computed: true,
<% end -%>
Type: schema.TypeList,
Optional: true,
Expand All @@ -227,6 +228,7 @@ var schemaNodeConfig = &schema.Schema{
"sandbox_config": {
<% if version.nil? || version == 'ga' -%>
Removed: "This field is in beta. Use it in the the google-beta provider instead. See https://terraform.io/docs/providers/google/guides/provider_versions.html for more details.",
Computed: true,
<% end -%>
Type: schema.TypeList,
Optional: true,
Expand Down